jeudi 29 octobre 2015

Union columns from different tables

Assuming I have 2 tables:
Persons: ID, Name
Pets: PName

I want to select all the IDs from Persons and assign each one with a different PName or NULL if there are more IDs.
Basically it looks like a simple select query from Persons and then somehow append a select query from Pets but I'm not sure how to do that. I tried to use JOIN and UNION but none of them gave me exactly what I wanted.

Aucun commentaire:

Enregistrer un commentaire