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 tables
table name: customer custid name
table name: order orderid custid amount
i want to delete the customers who have not any data/order in order table.
please write me the delete query
regards shohan
shohan |
|
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
|
thanks i have done it by the following
Delete FROM customer Where Not Exists (Select * order b Where 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
thanks i have done it by the following
Delete FROM customer Where Not Exists (Select * order b Where b.custid= customer.custid)
shohan
great.. You just are missing 'from' in your query.
Delete FROM customer Where Not Exists (Select * from order b Where b.custid= customer.custid) |
 |
|
|
|
|