I have a group of updates that need to be done using LAD DATA INFILE. Within this file there are some INSERTS. Is there anyway that after an INSERT happens I can use the auto-increment ID that was just generated in the next statement. Similar to PHP's mysql_insert_id() function. Thanks, Michael
No.1 | | 996 bytes | |
Hi,
Your query was understood as - you want to retrieve the current value of the autoincrement column, where mysql_insert_id also reveals the same.
Try either of this.
Use LIMIT:
select ID from tablename order by ID DESC LIMIT 1. or Use MAX()
select MAX(ID) from tablename
Thanks ViSolve DB Team.
Message From: "Michael Stearne" <mstearne (AT) entermix (DOT) com> To: <mysql (AT) lists (DOT) mysql.com> Cc: "Jim Ginn" <jim (AT) oats (DOT) com> Sent: Tuesday, September 19, 2006 10:11 PM Subject: Last Inserted ID Using LAD DATA
>I have a group of updates that need to be done using LAD DATA INFILE. Within this file there are some INSERTS. Is there anyway that after an INSERT happens I can use the auto-increment ID that was just generated in the next statement. Similar to PHP's mysql_insert_id() function.