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.
Author |
Topic |
anupalavila
Yak Posting Veteran
56 Posts |
Posted - 2009-04-03 : 04:07:44
|
Hai I have two tables CUSTOMERTB and QUOTATIONTB. How can I make a condition such that I can delete a customer from CUSTOMERTB if he has no quotations in QUOTATIONTBcustId (primary key) in CUSTOMERTB is foreign key in QUOTATIONTBThanks and Regards Anu Palavila |
|
bklr
Master Smack Fu Yak Hacker
1693 Posts |
Posted - 2009-04-03 : 04:55:12
|
try this onedelete from CUSTOMERTB where custId in (select t.empid from CUSTOMERTB t left join QUOTATIONTB e on e.custId = t.custId where e.custId is null) |
|
|
Naigewron
Starting Member
6 Posts |
Posted - 2009-04-03 : 06:05:29
|
Would this work, or am I missing a piece of info here?DELETE FROM CUSTOMERTB WHERE custId NOT IN (SELECT custId FROM QUOTATIONTB) |
|
|
|
|
|