更新时间:2023-01-31 14:10:43
这是组内查询"的示例.我喜欢使用group by
和having
解决它们,因为这是非常灵活的:
This is an example of a set-within-sets query. I like to solve them using group by
and having
, because this is a very flexible:
SELECT user_id
FROM action a
WHERE action_type IN (0, 3, 4, 5)
GROUP BY user_id
HAVING COUNT(DISTINCT action_type) = 4;