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