My current query looks like this:
SELECT DISTINCT (member), count( UID ) AS numUID
FROM memberdata
GROUP BY Member
ORDER BY count( UID ) DESC
What I get back, looks a lot like this:
A name 1 175
A name 2 38
A name 3 37
A name 4 36
A name 5 36
What I want to do now is get the count of numUID, in the above example I may get a result like:
**numUID** **COUNT**
175 1
38 1
37 1
36 2
I’ve searched far and wide, but I can’t seem to get the information I need to put this query together properly. Any help would be appreciated.
Thanks,
Use a subselect and another GROUP BY:
I should also warn you that you are also misusing
DISTINCT. When you useDISTINCTit always looks at the entire row. WritingDISTINCT(x) , yis exactly the same asDISTINCT x, y. When you useGROUP BYit is guaranteed that you will only get one row per group. There is no need to useDISTINCThere.