0
select distinct hash, title, count(*) as c
from pastes
where hash is not null
group by hash, title
order by c desc;
我可以根据查询中实时定义的'c'列对查询结果进行排序。如何在我的WHERE子句中使用聚合度量
但我也想加入C到WHERE子句:
select distinct hash, title, count(*) as c
from pastes
where c > 10 and hash is not null
group by hash, title
order by c desc;
ERROR: column "c" does not exist
LINE 1: ...inct hash, title, count(*) as c from pastes where c > 10 and...
^
什么是指定这样的查询的正确方法?
的HAVING节似乎与C语言对以完成工作。 – user3556757