sql - Join two tables to get common data based on a column -
i have 2 tables:
table1columnscola, colb, colctable2columnscolx, coly, colz
i'm trying rows table1 have colc values match table2 on colz.
i tried following:
select table1.cola,table1.colb,table1.colc table1 inner join table2 on table1.colc = table2.colz this not seem work result of query had 20 times number of rows present in table1.
any sincerely appreciated.
you can use exists this.
select table1.cola,table1.colb,table1.colc table1 exists (select 1 table2 table1.colc = table2.colz)
Comments
Post a Comment