Possible Duplicate:
mysql: Using LIMIT within GROUP BY to get N results per group?
I have a db with thousands of domains and data. I want to list only 100 rows of each domain. i can't use LIMIT 100 cause that only limits 100 records but I want dom1 to list 100 dom2 to list 100 dom3 to list 100
all in one query. This is what I have so far.
    SELECT domain COUNT(Key) AS DomCount
    FROM table_domain
    GROUP BY user,location
    ORDER BY domain,DomCount DESC
Could I use a CASE?
 
     
    