Andrew, Tuesday, April 30, 2002, 5:33:27 AM, you wrote: AW> Thank you very much for the leads. I looked at the section in the manual AW> and still have a few questions (I have added some more info which might AW> help).
AW> As a reminder my problem was ... >> AW> I have a DELETE statement: >> AW> delete bond_master,bond_data from bond_data where >> AW> bond_master.cusip=bond_data.cusip and bond_master.maturity <= AW> "2002/02/15"; >> >> >> If you use 3.23.X, you can find solution of your problem in the manual: >> http://www.mysql.com/doc/A/N/ANSI_diff_Sub-selects.html AW> First of all I am running... server version: 3.23.47-nt AW> Descriptions of the tables are listed below. AW> Table 1: Bond_master AW> Goal is to delete records from bond_data based on criteria related to AW> bond_master (link field is cusip) AW> I tried the following statement AW> mysql> select * from bond_data where cusip IN (select cusip from AW> bond_master); AW> ERROR 1064: You have an error in your SQL syntax near 'select cusip from AW> bond_master)' at line 1 Andrew, MySQL doesn't currently support sub-selects. Did you read the section 1.7.4.1 Sub-SELECTs of the manual (I gave you a link on this chapter)? "The first option is to use a procedural programming language (such as Perl or PHP) to submit a SELECT query to obtain the primary keys for the records to be deleted, and then use these values to construct the DELETE statement (DELETE FROM ... WHERE ... IN (key1, key2, ...)). The second option is to use interactive SQL to construct a set of DELETE statements automatically, using the MySQL extension CONCAT() (in lieu of the standard || operator). For example: SELECT CONCAT('DELETE FROM tab1 WHERE pkid = ', tab1.pkid, ';') FROM tab1, tab2 WHERE tab1.col1 = tab2.col2; You can place this query in a script file and redirect input from it to the mysql command-line interpreter, piping its output back to a second instance of the interpreter: shell> mysql --skip-column-names mydb < myscript.sql | mysql mydb " -- For technical support contracts, goto https://order.mysql.com/ This email is sponsored by Ensita.net http://www.ensita.net/ __ ___ ___ ____ __ / |/ /_ __/ __/ __ \/ / Victoria Reznichenko / /|_/ / // /\ \/ /_/ / /__ [EMAIL PROTECTED] /_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.net <___/ www.mysql.com --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php