sql server - sql - multiple layers of correlated subqueries -


i have table a, b , c

i want return entries in table not exist in table b , of list not exist in table c.

select * table_a not exists (select 1 table_b b a.id = b.id) 

this gives me first result of entries in not in b. want entries of result not in c.

i tried flavours of:

select * table_a not exists (select 1 table_b b a.id = b.id) , not exists (select 1 table_c c a.id = c.id) 

but isnt correct logic. if there way store results first query , select * result not existent in table c. i'm not sure how that. appreciate help.

you have 2 where clauses in (the external part of) second query. not valid sql. if remove it, should work expected:

select * table_a not exists (select 1 table_b b                   a.id = b.id) ,       not exists (select 1 table_c c            -- removed                   a.id = c.id) ; 

tested in sql-fiddle (thnx @alexander)


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -