Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Delete Help

Status
Not open for further replies.

markphsd

Programmer
Jun 24, 2002
758
US
What's wrong with this:

DELETE
From ContactPurchases
INNER JOIN OrderDetails
ON ContactPurchases.OrderDetailID=OrderDetails.OrderDetailID

I get this error:

Server: Msg 156, Level 15, State 1, Line 3
Incorrect syntax near the keyword 'INNER'.

But it works find when using it as a SELECT.

thanks,

Mark P.
Providing Low Cost Powerful Point of Sale Solutions.
 
You can only delete from one table at a time. As such, you need to specify which table to delete from. You do that like this...

Code:
DELETE [!]ContactPurchases[/!]
From ContactPurchases
INNER JOIN OrderDetails
ON ContactPurchases.OrderDetailID=OrderDetails.OrderDetailID

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top