sql server 2008 - Select query with a condition in SQL -


i have 2 tables table-a , table-b.

table-a contains

id            1 2 3 4 

table-b contains

id    tno  data 1      1    regec 1      2    marsec 1      0    lorem 2      1    ipsum 2      0    doller 3      2    sit 3      0    amet 3      1    lipsum 

in these tables id column primary key. want id's table-a, don't have corresponding row in table-b tno '2'.

my result set looks this

id 2 4 

select a.id tablea a.id not in (     select b.id     tableb b     b.tno = 2 ) 

sqlfiddle demo


Comments

Popular posts from this blog

php - mySql Join with 4 tables -

css - Text drops down with smaller window -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -