答案 0 :(得分:2)
您一次只能使用一个聚合函数。
ANSI标准的方法是做你想要的:
select count(*)
from t
group by ?
order by count(*) desc
fetch first 1 row only;
或者子查询:
select max(cnt)
from (select count(*) as cnt
from t
group by ?
) x;
请注意,您需要group by
某些内容,可能是id_r
。
答案 1 :(得分:1)
试试这个:
SELECT MAX(e1) as Expr1 FROM (
SELECT COUNT(id_r) as e1
FROM Angajat) as t1
COUNT(id_r)
只返回1个结果,因为没有group by子句。因此,没有使用max。
您需要在子查询中添加group by子句:
SELECT MAX(e1) as Expr1 FROM (
SELECT column1, COUNT(id_r) as e1
FROM Angajat
GROUP BY column1
) as t1