Originally Posted by davidklonski
This propably isn't the most effective way when considering query optimization, but I THINK it works Please, feel free to correct and educate me on this
LEFT JOIN Pets ON Ownership.Pet_ID=Pets.ID
WHERE Pets.Type NOT LIKE 'Dog'
Here's another version that returns a table that lists the owner ID, owner name and the type of the pet she/he has. You can use this to test that your query really returns the right results:
I used http://dev.mysql.com/doc/mysql/en/JOIN.html for reference. Hopefully this will help a bit!
People.ID AS Owner_ID,
People.Name AS Owner_Name,
Pets.Type AS Pet_type
Ownership ON People.ID=Ownership.Person_ID
Pets ON Ownership.Pet_ID=Pets.ID
Pets.Type NOT LIKE 'Dog'