Skip to content
Advertisement

How to Join two tables on two separate variables with one variable having the same name

This is what I have so far. I’m trying to join these two tables and if I do not use a using() function, then SQL tells me there is an invalid relational operator just simply using an ON. However using a “using” also throws an error that I did not end it properly. Any help would be nice, thanks.

Advertisement

Answer

You have two choices. One is where:

The other is ON:

Think of USING as a short-hand to handle the case where all the JOIN keys have the same name. If this is not the case, then just use ON.

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