I am working for a client and they have two tables:
pet_species (ID, type_id, name)
pet_types (ID, name)
What I need is to get all pet_species from the table and then their pet type by joining via the type_id. That bit I can easily do with the following:
SELECT pet_species.ID, pet_species.name, pet_types.name FROM pet_species
INNER JOIN pet_types ON pet_types.ID = pet_species.type_id
But I also need to get pet_types which have no pet_species link. Is it possible to merge these two use cases together into one single SQL?
classic LEFT OUTER JOIN problem
ON pet_species.type_id = pet_types.ID
This topic is now closed. New replies are no longer allowed.