MySQL Forums
Forum List  »  Newbie

Re: INSERT questions
Posted by: Puiu Hrenciuc
Date: September 08, 2004 05:49PM

1. Quoting from the MySQL manual :
"You can retrieve the most recent AUTO_INCREMENT value with the LAST_INSERT_ID() SQL function or the mysql_insert_id() C API function. These functions are connection-specific, so their return value is not affected by another connection also doing inserts. ", so doing a "SELECT LAST_INSERT_ID() AS LastID" would return a single row with a single column named "LastID" wich will contain the auto_increment value of the last inserted record.

2. Wou definitely don't need to SELECT a row before UPDATE it !!! For eg., using the above table structure, you can do an UPDATE like this :

UPDATE `global` SET name='name_value', value='value_value:)'
WHERE id='The_id_value_of_the_row_you_want_to_update" ;


Options: ReplyQuote


Subject
Written By
Posted
September 08, 2004 01:30PM
Re: INSERT questions
September 08, 2004 05:49PM


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.