I'm having some troubles with a MySQL Query.
I want to select all the elements from a table, grouping from a certain column, BUT only retrieve those where ALL the elements in the group matches the WHERE clause.
For example, I have a table called "pets" with 3 columns:
Id| animal | name
1 | dog | marge
2 | dog | homer
3 | cat | marge
4 | cat | lenny
5 | rabbit | homer
5 | rabbit | carl
6 | rabbit | marge
And I want to pick all the animals where ALL his group members have name IN('homer','bart','marge','lisa','maggie')
If you can't understand my question, let me know. Thanks!