From: Date: April 23 2001 9:24am Subject: LAST_INSERT_ID returning wrong value after multiple row insert in a single query List-Archive: http://lists.mysql.com/bugs/10600 Message-Id: <001201c0cbc6$6ec7e0d0$6400a8c0@lunapark.local> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit # This occurs in MySQL 3.23.36, win32 version. # I haven't seen anything about it in the 3.23.37 change list, # nor have I seen a report of it in the win32 list # or in the bug tracker on sourceforge. # # Statements to reproduce (you can use this message as script): # drop table if exists test9; create table test9 (i1 int auto_increment primary key, i2 int); insert into test9 (i2) values (11),(12),(13); select last_insert_id(); insert into test9 (i2) values (14),(15),(16); select * from test9; select last_insert_id(); # The last_insert_id() function returns the value corresponding # to the _first_ inserted row for each INSERT query, # instead of the last (i.e. values 1 and 4 instead of 3 and 6 # here, respectively).