I\'m trying to fetch the most popular tags from all videos in my database (ignoring blank tags). I also need the \'flv\' for each tag. I have this working as I want if each
select tag, flv, count(*) as tag_count
from (
select tag_1 as tag, flv from videos
UNION
select tag_2 as tag, flv from videos
UNION
select tag_3 as tag, flv from videos
) AS X
I think that will do it, although there will be double-counting if any record has the same values for two of the tags.
UPDATE: added AS X.