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 |
|
melon.melon
Yak Posting Veteran
76 Posts |
Posted - 2009-06-18 : 05:23:58
|
| I want to delete from tbCost1 if "no" is not found in tbCost2 & tbCost3 :Delete from tbCost1 where Not EXISTS (select * from tbCost2 a Inner Join tbCost3 b where a.no='222' and b.no='222') and no='222' |
|
|
raky
Aged Yak Warrior
767 Posts |
Posted - 2009-06-18 : 05:40:45
|
| try thisDelete t1from tbCost1 t1left join tbcost2 t2 on t2.no = t1.noleft join tbcost3 t3 on t3.no = t1.nowhere t1.no= '222'and t2.no is null and t3.no is null |
 |
|
|
melon.melon
Yak Posting Veteran
76 Posts |
Posted - 2009-06-18 : 06:10:28
|
| Incorrect syntax near 'a'.Delete from t1 a left join t2 b on t2.no=t1.noleft join t3 c on t3.no=t1.no where a.no='222' and b.no is null and c.no is null |
 |
|
|
melon.melon
Yak Posting Veteran
76 Posts |
Posted - 2009-06-18 : 21:49:42
|
| Thanks for your help, was my mistake i didnt understand that i need to put in that part so i left it out.[/quote] Delete t1from tbCost1 t1[/quote] |
 |
|
|
|
|
|