Markus, Tuesday, May 28, 2002, 2:15:09 PM, you wrote: >> You can use IGNORE keyword in INSERT statement, but it's not quite the >> same as "INSERT IF NOT EXIST". If you specify IGNORE, any rows that >> duplicate an existing PRIMARY or UNIQUE key in the table >> will be ignored in INSERT:
ML> Yes, I was aware of the INSERT IGNORE statement, but I've only got one ML> primary/unique key, which happens to be the id. ML> Perhaps I should elaborate further. ML> I've got three tables; ip_name_tbl, loc_tbl and conn_tbl. ML> ip_name_tbl has got fields id, comp_loc, ip_stat_dyn, ip, ML> mac, network, name and comments. ML> loc_tbl has got fileds id, comp_loc and loc_name and ML> conn has got fileds id, wall_nr, hub_switch_nr, comp_id. ML> ip_name_tbl.comp_loc points to loc_tbl.comp_loc=20 ML> conn.comp_id points to ip_name_tbl.id. ML> I want to be sure that while inserting values, say ML> NULL (since id is AUTO_INCREMENT), 1 and "Administration", ML> "administration" isn't already in the table. ML> Rob's idea is of course a solution, but that sort of brings me back to ML> my original question : "is there a -SIMPLE- way"? ; ) Nope. You can't do it with one SQL statement ... ML> INSERT IGNORE wouldn't, if I understood the manual correctly, ML> help me here, since the other rows in the table aren't UNIQUE, no? If your column for value "Administration" is not indexed as PRIMARY or UNIQUE key, INSERT IGNORE is not that you want ... ML> Cheers, ML> Markus -- For technical support contracts, goto https://order.mysql.com/?ref=ensita 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