List:General Discussion« Previous MessageNext Message »
From:Jim Faucette Date:May 30 1999 1:05am
Subject:Re: last_insert_id() - strange ??
View as plain text  
Darren Sweeney wrote:
> 
> Solution??
> 
> Is using max(id) just as, if not more efficient? Same results ...
> 

If you want the last insert in ANY table max() is your best choice.
LAST_INSERT_ID is connection based. So if you open a connection and
insert into table A, then B, then LAST_INSERT_ID it will give you the
one for B.

If you open a connection and LAST_INSERT_ID before any insert it will
return 0.

  jim...
Thread
last_insert_id() - strange ??Darren Sweeney30 May
  • Re: last_insert_id() - strange ??Jim Faucette30 May
Re: last_insert_id() - strange ??Darren Sweeney30 May
  • Re: last_insert_id() - strange ??Paul DuBois30 May
  • Re: last_insert_id() - strange ??Graham Ashton30 May
Re: last_insert_id() - strange ??Darren Sweeney30 May
  • Re: last_insert_id() - strange ??Jim Faucette30 May