having 和where是否可同时使用?

having和where同时使用的例子?

可以。example
select count(*), person_id
from per_all_people_f
where sysdate between effective_start_date and effective_end_date
group by person_id
having count(*) > 1
温馨提示:内容为网友见解,仅供参考
第1个回答  2012-05-17
where用于前面的过滤,having用于后面groupby后的过滤,两者不冲突。完全可以同时使用。
第2个回答  2012-05-17
当然可以。
where是在汇总之前进行筛选;
having 是在汇总之后进行筛选。
相似回答