SQL select from last inserted

Posted by arik-so on Stack Overflow See other posts from Stack Overflow or by arik-so
Published on 2010-05-19T18:42:27Z Indexed on 2010/05/19 18:50 UTC
Read the original article Hit count: 136

Filed under:
|
|
|
|

Hello,

in MySQL, I have table. One column has auto-increment. When I insert something

mysql_query('INSERT INTO `table` SET `column` = "data";');

Now, what I want is, without further queries, to get the value of the auto-incrementing column, maybe like this:

mysql_query('insertion = (INSERT INTO `table` SET `column` = "data"); 
SELECT `auto_incrementing_column` FROM `table`.insertion');

Please tell me how something like that is done. Thanks in advance!

© Stack Overflow or respective owner

Related posts about sql

Related posts about select