postgresql 我想得到一个结果

ruyhziif  于 2022-11-23  发布在  PostgreSQL
关注(0)|答案(1)|浏览(149)

我试图得到一个百分比计算我有一个错误。

ERROR:  syntax error at or near "100"
LINE 1: SELECT dispute_lost , ROUND(COUNT() 100/SUM(COUNT (*)) OVER(...
                                           ^
SQL state: 42601
Character: 37

查询:

SELECT dispute_lost , ROUND(COUNT() 100/SUM(COUNT (*)) OVER(),2) AS Percentage_lost
FROM yellevate_invoices
GROUP BY dispute_lost;
bzzcjhmw

bzzcjhmw1#

您需要对某些内容进行计数,但不能对任何内容都进行计数。不接受COUNT()。COUNT agergate的语法为:

COUNT( [ { DISTINCT | ALL } ] <expression>)
<expression ::= { * | <scalar_expression> }

相关问题