sql - Use the foreign key that a query selects to get data within the same query -
i have issue query trying build. idea have 3 tables 2 have foreign keys. want make query selects foreign key table , uses same key data key b.
so this:
select id, foreignkey1 tablea (select id tableb id = foreignkey1);
but somehow not able or find documentation it.
this simple inner join
:
select * tablea inner join tableb b on a.foreignkey1 = b.id
Comments
Post a Comment