limiting a query to a specific item
Posted
by
Dev-Ria
on Stack Overflow
See other posts from Stack Overflow
or by Dev-Ria
Published on 2012-12-14T16:55:05Z
Indexed on
2012/12/14
17:03 UTC
Read the original article
Hit count: 124
mysql
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?
© Stack Overflow or respective owner