I wonder how the following could be solved with a mysql query, but don’t really know how to proceed past my first count.
In a table there is user ids and an item id they have.
user_id | item
--------------
12 | 1
11 | 3
34 | 1
12 | 2
34 | 2
9 | 1
12 | 3
If I group by user_id and count the user_id, I get a list of users and how many items they have won, like:
user_id | count(user_id) i.e. how many items have they won
-----------------------
9 | 1
11 | 1
12 | 3
34 | 2
How can I in turn count how many users have won 1, 2 or 3 items, ie. count the result of the count, grouped by the count of user_id?
Select from the select: