1 Upvote

Join on Multiple Columns in SQL Query

SQL
Querying

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

By analyseup - Last Updated Aug. 29, 2021, 2:54 p.m.

Did you find this snippet useful?

Sign up to bookmark this in your snippet library

COMMENTS
RELATED SNIPPETS
left join LATERAL
SQL
Querying

2
median
SQL
Querying

2
SQL creating a view
SQL
Querying

1
SQL window function
SQL
Querying

1
SQL RANK
SQL
Querying

1
Top Contributors
103
100