just wondering if it is possible to get the top 10 COUNT results and ordering by COUNT and alphabetically?
I have the following tables,
tags
-------
Does the query work? If yes, you could use LIMIT 0, 10
to get only the top 10 rows.
SELECT tag.*, COUNT(td.tag_ID) AS tagcount
FROM Tagged td
LEFT JOIN gen_Tags tag ON td.tag_ID = tag.tag_ID
GROUP BY td.tag_ID
ORDER BY tagcount DESC, tag.tag_Title ASC LIMIT 0, 10
Another thing you might be interested in, is ranking. See here: http://www.fromdual.com/ranking-mysql-results
Edit
Maybe a subquery does what you want:
SELECT list.* FROM (
SELECT tag.*, COUNT(td.tag_ID) AS tagcount,
FROM Tagged td
LEFT JOIN gen_Tags tag ON td.tag_ID = tag.tag_ID
GROUP BY td.tag_ID
ORDER BY tagcount DESC LIMIT 0, 10
) AS list ORDER BY list.tag_Title ASC, list.tagcount DESC