I have the table PETS with columns Index, Owner and Animal with following rows:
Index, Owner, Animal
--------------------
1, Anne, cat
2, Anne, dog
3, Anne, rabbit
4, Bill, dog
5, Bill, dog
6, Bill, rabbit
7, John, cat
8, John, dog
9, Johh, parrot
10, Susy, rabbit
11, Susy, parrot
12, Susy, parrot
I need two outputs: Get all Owners which own
- a cat OR a dog
- a cat AND a dog
The first output I get with IN as shorthand operator for OR:
SELECT DISTINCT Owner FROM PETS WHERE Animal IN ('cat','dog')
Is there an equivalent shorthand operator for AND? The solution in this thread with HAVING COUNT does not quite work as it returns 'Bill' as there is 'dog' twice, however there is no 'cat'.