Skip to content
Advertisement

Full join two tables on a nonidentical column

Assume T1 is

and T2 is

I’d like to make

The command that I am using is

It results in

It is missing id=3. What should I use instead of T1.id in the select command to get all the ids and not just those from T1?

Advertisement

Answer

You want a full join. You can emulate it with this method:

If your database supports full join, you would use either:

or:

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement