Hi Sven,
Last_insert_id is not what your're looking for, for the same reason you give
about max(id) : your insert can find a duplicate key because another user
inserted an id between two of yours.
Last_insert_id gives just the last auto_increment id for success in insertion.
Suppose that your inse
On 19.05., [EMAIL PROTECTED] wrote:
> If you add another command,
> mysql> insert into bla1 values (NULL, "Cello3", NULL) on duplicate key update
> whentime = NOW();
> The right ID will be used.
Yes, if I insert an new value then the ID column gets incremented. But if I
try to insert an existing v
Hi,
If you add another command,
mysql> insert into bla1 values (NULL, "Cello3", NULL) on duplicate key update
whentime = NOW();
The right ID will be used.
Since last_insert_id() has a connection scope, it's better for you to use :
select max(id) from bla1;
Mathias
Selon Sven Paulus <[EMAIL P