Join on Multiple Columns in SQL Query

SQL

Joining tables in SQL on more than one column works in the same way as joining a single column but we simply add "and" between the join conditions.

select *
from table_1 a
join table_2 b
on a.column_1= b.column_1 and a.column_2 = b.column_2
Did you find this snippet useful?

Sign up for free to to add this to your code library

median
SQL

4
SQL RANK
SQL

4
EXISTS
SQL

3