sql - Join two tables to get common data based on a column -


i have 2 tables:

  • table1 columns cola, colb, colc
  • table2 columns colx, 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

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

php - Find a regex to take part of Email -