tsql - Sql Query help to get non matching records from two tables -


i trying non matching records 2 tables

for ex

tablea  id           account  1               acc1  2               acc2  3               acc3   tableb  opp          accountid  opp1            1  opp2            2  opp3            4 

i need know accountid present in tableb not available in tablea. wonderful explain how approach query.

required record opp3 of tableb

thanks

prady

create table #one (id int,acc nvarchar(25)) insert #one (id , acc) values(1,'one')  insert #one (id , acc) values(2,'two')  insert #one (id , acc) values(3,'three')   create table #two (acct nvarchar(25),ids int) insert #two (acct,ids) values('one',1)  insert #two (acct,ids) values('two',3)  insert #two (acct,ids) values('four',4)   select ids #two except select id #one   drop table #one  drop table #two  

test one


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -