以下两个查询产生完全相同的结果:
select country, count(organization) as N
from ismember
group by country
having N > 50;
select * from (
select country, count(organization) as N
from ismember
group by country) x
where N > 50;
每个HAVING
子句都可以用子查询和WHERE
这样的子句代替吗?或者在某些情况下,一个HAVING
子句是绝对必要的/更强大/更有效/无论如何?