Jesse wrote:
> I need to delete some records based on a JOIN relation. The following
> works in Microsoft SQL Server, and the syntax appears to be correct
> for MySQL, but it reports "syntax..near 'DELETE FROM ConvInvDet FROM
> ConvInvDet H...". What's the proper way to format this for MySQL?
>
> DELETE FROM ConfInvDet
> FROM ConfInvDet H LEFT JOIN ConfInvoices I ON I.InvoiceNo=H.InvoiceNo
> WHERE I.ID IS NULL;
Lose the first FROM.
PB.
>
> Basically, I'm trying to delete orphan records. I'm using MySQL 5.
>
> Thanks,
> Jesse
>
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.394 / Virus Database: 268.9.5/376 - Release Date: 6/26/2006