Join table using two identifiers not just one
-
07-07-2021 - |
Pregunta
I have been trying to find a way to join two tables on two column identifiers. ie in "pseudo-query":
join table1 to table2 where table1.x = table2.y and table1.a = table2.b
Can I do this using a join statement without using a where statement explicitly? Or would it just be best to do select from table1,table2 where x=y and a=b? Thanks for the suggestions!
Solución
You could use a from clause like this:
from table1 inner join table2 on table1.x = table2.y and table1.a = table2.b
Otros consejos
Sure you can:
select
*
from
table1 a join table2 b on
(a.some_column = b.some_column and a.other_column = b.other_column)
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow