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 |
shohan_db
Starting Member
36 Posts |
Posted - 2010-08-25 : 04:00:38
|
i have two tablestable name: customer custid nametable name: order orderid custid amounti want to delete the customers who have not any data/order in order table.please write me the delete queryregardsshohanshohan |
|
sakets_2000
Master Smack Fu Yak Hacker
1472 Posts |
Posted - 2010-08-25 : 04:20:18
|
have you tried anything on this yet? Post it and someone will help you from there. |
|
|
shohan_db
Starting Member
36 Posts |
Posted - 2010-08-25 : 04:33:20
|
thanksi have done it by the followingDelete FROM customerWhere Not Exists(Select * order bWhere b.custid= customer.custid)shohan |
|
|
sakets_2000
Master Smack Fu Yak Hacker
1472 Posts |
Posted - 2010-08-25 : 04:39:10
|
quote: Originally posted by shohan_db thanksi have done it by the followingDelete FROM customerWhere Not Exists(Select * order bWhere b.custid= customer.custid)shohan
great.. You just are missing 'from' in your query.Delete FROM customerWhere Not Exists(Select * from order bWhere b.custid= customer.custid) |
|
|
|
|
|