It depends on which version of MySQL you are using.  Since you are using a
subquery, I assume you are using a fairly new version.

Delete audit_log_records from audit_log_records, audit_log where
audit_log_records.tracker_id = audit_log.tracker_id and
audit_log.operation='A'

That should be it.  It's called a multi-table delete, but you are only
deleting from one table.  You can't use left join or inner join with a
multi-table delete or update.  You have to do a comma join.

Donny

> -----Original Message-----
> From: Bob Lockie [mailto:[EMAIL PROTECTED]
> Sent: Monday, May 31, 2004 2:37 PM
> To: MySQL Mailing List
> Subject: rework this
> 
> I need help with this SQL.
> I want to delete all records from the 'audit_log_records' table that
> have 'tracker_id' columns that are the same as those from the audit_log
> table that have 'A' for the operation type.
> 
> delete from audit_log_records where tracker_id=(select tracker_id from
> audit_log where audit_log.operation='A');
> 
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:
> http://lists.mysql.com/[EMAIL PROTECTED]
> 




-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to