SELECT DISTINCT and count

the table looks like this:

tag | entryID ----+--------- foo | 1 foo | 2 bar | 3 

And now I want to get all the tags using it:

 foo | 2 bar | 1 

How can i do this?

thanks

+7
mysql select count distinct
source share
1 answer
 select tag, count(*) from MyTable group by tag 
+22
source share

All Articles