List:General Discussion« Previous MessageNext Message »
From:Philip Hallstrom Date:March 3 2000 4:23am
Subject:Re: Getting LAST_INSERT_ID() value in same statement?
View as plain text  
> Philip Hallstrom wrote:
> 
> > INSERT INTO table VALUES (0, LAST_INSERT_ID())
> > But instead I get:
> > 
> > x       y
> > 1       0
> > I know I can follow up my INSERT with an UPDATE, but I'd rather not have
> > to.  Is there any way around this?
> 
> Can't see nice workaround. Maybe LAST_INSERT_ID()+1? At least current
> behaviour is correct because usually it's more important to remember
> last id from the past.

Rats.  Oh well... LAST_INSERT_ID()+1 won't work for me because in reality
I am only doing *one* query.  I just want two columns of my table to have
the auto_increment value (but only sometimes :)

I'll live with the second UPDATE... it's not a high volume query...

thanks!

-philip

Thread
Getting LAST_INSERT_ID() value in same statement?Philip Hallstrom3 Mar
  • Re: Getting LAST_INSERT_ID() value in same statement?Tonu Samuel3 Mar
    • Re: Getting LAST_INSERT_ID() value in same statement?Philip Hallstrom3 Mar