I'm trying to return a count of return users which happens when there is a duplicate 'user_id and action_type'.
So if you refer below, I would like my output to be = 2, since user_id (5) has 2 similar action_types (234) and user_id (6) also has 2 similar action_types (585).
How do I structure my query to reflect this?
Table t1
User_Id Action_Type
--------- ------------
5 234
5 846
5 234
6 585
6 585
7 465
SELECT COUNT(DISTINCT User_Id) FROM (
SELECT User_Id
FROM t1
GROUP BY User_Id, Action_Type
HAVING COUNT(*) > 1
) t