sql - Inner Join Tables But Select From One Table Only -


i have 2 tables join may compare field , extract records 1 table field being compared not in both tables:

table --------- comp   val 111    327 112    234 113    265 114    865   table b ----------- comp2   val2 111     7676 112     5678 

so im doing join both tables on comp-comp2, wish select values table corrssponding comp not exist in table b. in case, query should result in:

result --------- comp   val 113    265 114    865 

here query:

select * result tablea inner join tableb on (tableb.comp2 = tablea.comp) tableb.comp2 <> tablea.comp 

problem is, pulls values both tables. there way select values tablea alone without specifying fields explicitly?

i think want this, though:

select  *     tablea             not exists (select b.comp2 tableb b a.comp1 = b.comp2) 

that find records in don't exist in b.


Comments