[英]SQL Select users with condition verified in multiple rows
select user
from your_table
where service in (4,5)
and active = TRUE
group by user
having count(distinct service) = 2
要么
select user
from your_table
group by user
having sum(active = TRUE and service = 4) > 0
and sum(active = TRUE and service = 5) > 0
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.