Reputation: 13315
My Table Structure is:
artist_id category
1 Song
1 Song
1 Song
1 Video
1 Video
Now, my output must be
id category total
1 Song 3
1 Video 2
How this can done by using MYSQL.
Upvotes: 0
Views: 62
Reputation: 11910
I think this should work (untested):
select artist_id, category, count(*) as total from table group by artist_id, category
Upvotes: 3