sql - Delete statement with a subquery -
i have write delete statement customer table. delete customers have not put in orders. use subquery , exist operator.
im having trouble proper way query should displayed tested , had no luck with. can tell me how fix statement?
delete customers dbo.customers (customerid not exist (select customerid dbo.orders customerid = ordersid))
your syntax using exist operator off, although general idea in right direction:
delete dbo.customers not exists (select * dbo.orders dbo.customers.customer_id = dbo.orders.customer_id)
Comments
Post a Comment