Distinct count with multiple columns
I've been looking around and can't find an answer to this question on
finding a distinct match. I have a table that looks like
ID Category Relevancy
192820 273003000 2
242567 273003000 2
510711 273003000 2
510711 273003002 34
542178 273003000 1
542178 273003002 2
688833 273003000 3
734917 273003002 2
888879 273003000 1
891624 273003002 3
So for each id they can have multiple categories and the relevancy is what
what category number (1 is the first category, 2 second, 34 the thirty
fourth category for that id).
I want to query where I can search the count of the Category but if the id
has already been counted for a category it will not be counted.
So for this the answer would look like:
Category Count
273003000 6
273003002 2
Thanks for the help!!
No comments:
Post a Comment