Logan, David (SST - Adelaide):
> It looks like the LAST_INSERT_ID() is returning the id of the last
> auto_increment INSERT, this seems to be in line with the documentation.
>
> <quote>
>
> The ID that was generated is maintained in the server on a per-connection
> basis. This means that the value which the function returns to a given
> client is the first AUTO_INCREMENT value generated for most recent
> statement affecting an AUTO_INCREMENT column by that client.
>
> </quote>

It all depends on what "[the] most recent statement" means – or "the last 
INSERT or UPDATE query" in the part Gleb quoted. When I do this:

insert into child (parent_ID, value) values (last_insert_ID(), 'b1'), 
(last_insert_ID(), 'b2'), (last_insert_ID(), 'b3');

is that one statement, or three? I think all of it, from "insert" to the 
semicolon, is a single statement. Do you mean that "(last_insert_ID(), 'b2')" 
is a statement on its own?

Björn Persson

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to