[英]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.