List:General Discussion« Previous MessageNext Message »
From:Mattia Merzi Date:December 27 2009 4:27pm
Subject:Re: last_insert_id
View as plain text  
2009/12/27 Victor Subervi <victorsubervi@stripped>:
> mysql> select * from products;
> mysql> select last_insert_id() from products;
> Now, I was expecting 1, not 0! What up?

[...] LAST_INSERT_ID() (no arguments) returns the first
automatically generated value successfully inserted for
an AUTO_INCREMENT column as a result of the most
recently executed INSERT statement. [...] If no rows
were (successfully) inserted, LAST_INSERT_ID() returns 0.


last_insert_idVictor Subervi27 Dec
  • Re: last_insert_idMattia Merzi27 Dec
    • Re: last_insert_idVictor Subervi27 Dec
      • Re: last_insert_idMichael Dykman27 Dec
        • Re: last_insert_idVictor Subervi27 Dec
          • Re: last_insert_idGary Smith27 Dec
            • Re: last_insert_idVictor Subervi27 Dec
            • Re: last_insert_idCarsten Pedersen27 Dec
  • Re: last_insert_idSteve Edberg27 Dec
    • Re: last_insert_idGary Smith27 Dec
      • Re: last_insert_idMark Goodge27 Dec