I have a mysql table like:
id, visitorid, pageid
When a visitor hits the website it stores their visitor id and the page id as a row.
I could solve it this way:
SELECT cnt, COUNT(cnt) FROM ( SELECT COUNT(visid) as cnt FROM vislog GROUP BY visid ) x GROUP BY cnt ORDER BY cnt ASC
The little x is important.
x