
Originally Posted by
djeyewater
oh, then it ~must~ be okay 
just make sure you use it exactly as they suggested:If a table contains an AUTO_INCREMENT column and INSERT ... ON DUPLICATE KEY UPDATE inserts a row, the LAST_INSERT_ID() function returns the AUTO_INCREMENT value. If the statement updates a row instead, LAST_INSERT_ID() is not meaningful prior to MySQL 5.1.12. However, you can work around this by using LAST_INSERT_ID(expr). Suppose that id is the AUTO_INCREMENT column. To make LAST_INSERT_ID() meaningful for updates, insert rows as follows:
INSERT INTO table (a,b,c) VALUES (1,2,3)
ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id), c=3;

Originally Posted by
djeyewater
Do you mean have a manual auto increment on the id column, or instead use the column I'm inserting values to as the primary key, and loose the id column altogether?
yes, i might consider not having an auto_increment key at all
Bookmarks