Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 select all but not rows that exists in table 2

Author  Topic 

magmo
Aged Yak Warrior

558 Posts

Posted - 2014-09-27 : 04:02:45
Hi

I have 3 tables, 2 of them are inner joined on a varchar column (bookname) which is fine. But if this "bookname" is present in table 3 I don't want to display it in the result, can someone please show me how to do this?

gbritton
Master Smack Fu Yak Hacker

2780 Posts

Posted - 2014-09-27 : 07:25:09
quote:
Originally posted by magmo

Hi

I have 3 tables, 2 of them are inner joined on a varchar column (bookname) which is fine. But if this "bookname" is present in table 3 I don't want to display it in the result, can someone please show me how to do this?



Select ...
From table1
Join table2 ...
Where bookname not in (select book name from table3)
Go to Top of Page

magmo
Aged Yak Warrior

558 Posts

Posted - 2014-09-29 : 01:11:07
Ahh, thanks a lot!
Go to Top of Page
   

- Advertisement -