I am not sure how to phrase this question so I’ll give an example:
Suppose there is a table called tagged that has two columns: tagger and taggee. What would the SQL query look like to return the taggee(s) that are in multiple rows? That is to say, they have been tagged 2 or more times by any tagger.
I would like a ‘generic’ SQL query and not something that only works on a specific DBMS.
EDIT: Added “tagged 2 or more times by any tagger.”
HAVINGcan operate on the result of aggregate functions. So if you have data like this:It sounds like you want Cat, Horse.
To get the taggee’s that are in multiple rows, you would execute:
That being said, when you say “select only rows with multiple hits for a specific column”, which row do you want? Do you want row 1 for Cat, or row 2?