Answer the question
In order to leave comments, you need to log in
How to get the number of users with 2 claims?
The question is simple, but I've been stupid for a long time.
There is a table of requests: id, user_id, event_id. I need to get the number of users who have applications for 2 different events at the same time. Those. need something like
count(user_id) ... where event_id in (1,2)
Answer the question
In order to leave comments, you need to log in
select count(*) from (select user_id from events group by user_id having count(event_id) >= 2)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question