Different approach, use a rank function and then Inner Join to tags table:
Select t.tag_name
From tags t Inner Join (
Select tag_id, rank() Over (Order By taguse desc) as tagrank
From (Select tag_id,count(tagid) as taguse From phototags Group By tag_id)
) p On t.id=p.tag_id
Where tagrank<=5
2
Answers
Different approach, use a rank function and then Inner Join to tags table:
Haven`t written on MySQL, but in MS.Access the following code will work:
it just allows to JOIN tables without showing any of the columns from it.