MySQL Forums
Forum List  »  Newbie

Comlpex delete query without sub-select
Posted by: stephen_winer
Date: April 14, 2005 01:42PM

I need to write a query for MySQL that performs the following query, but I can't use a sub-select because I am locked into a version of MySQL before 4.1:

Delete * from TEST where ID in (Select ID from CUSTOMER LIMIT 10)

In English, I want to delete all the rows from the TEST table that correspond to 10 IDs returned from the sub-query. This is a simplification of what I really want to do, but this is the jist of it. This allows me to delete everything about 10 different customers and will also allow me to throttle how much data is deleted from the table in any one delete execution, which can help with performance for very large tables.

Please give any advice that you may have.

Steve

Options: ReplyQuote


Subject
Written By
Posted
Comlpex delete query without sub-select
April 14, 2005 01:42PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.