vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| I have a group of updates that need to be done using LOAD 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 |
| ||||
| 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. ----- Original Message ----- From: "Michael Stearne" <mstearne@entermix.com> To: <mysql@lists.mysql.com> Cc: "Jim Ginn" <jim@oats.com> Sent: Tuesday, September 19, 2006 10:11 PM Subject: Last Inserted ID Using LOAD DATA >I have a group of updates that need to be done using LOAD 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 > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: > http://lists.mysql.com/mysql?unsub=m...rt@visolve.com > |