sql - Select from Header when detail value is certain value -
i want select table has 1 many relationship detail table. want rows not have value in detail table. in illustration not want select row1
because has value of c
in detail table.
table 1 0 |row1 1 |row2 2 |row3 3 |row4 table2 0 |a 1 |a 2 |a 3 |a 0 |c 1 |b 2 |b 3 |b
bonus can done join
?
select * table1 t1 not exists (select 1 table2 t2 t1.tableid = t2.tableid , t2.column2 = 'c')
sql sql-server tsql not-exists
No comments:
Post a Comment