List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:January 29 2002 11:23pm
Subject:Re: next insert id
View as plain text  
At 17:03 -0800 1/29/02, Joel Wickard wrote:
>database,sql,query,table
>
>
>I need to find out what the next value will be in an auto_increment field
>will be. could someone help me out with the select statement?

You can't find out what it *will be* until you actually create the record.
Then you get the like this:

SELECT LAST_INSERT_ID();

Check the discussion for LAST_INSERT_ID() in the MySQL manual.

It will tell you the answer to your next question. :-)

Thread
next insert idJoel Wickard30 Jan
  • Re: next insert idJames Montebello30 Jan
    • Re: next insert idNathan30 Jan
      • Re: next insert idChristopher Thompson30 Jan
    • Re: next insert idChristopher Thompson30 Jan
      • Re: next insert idJames Montebello30 Jan
        • Re: next insert idPaul DuBois30 Jan
    • Re: next insert idPaul DuBois30 Jan
      • Re: next insert idJames Montebello30 Jan
        • RE: next insert idRoger Baklund30 Jan
        • Re: next insert idPaul DuBois30 Jan
  • RE: next insert idJohnny Withers30 Jan
    • Re: next insert idlaszlo30 Jan
      • Re: next insert idPaul DuBois30 Jan
  • Re: next insert idPaul DuBois30 Jan
    • Re: next insert idPaul DuBois30 Jan
      • Re: next insert idJames Montebello30 Jan
        • Re: next insert idPaul DuBois30 Jan
        • Re: next insert idDL Neil30 Jan
          • Re: next insert id (slightly OT)William R. Mussatto30 Jan
            • Re: next insert id (slightly OT)DL Neil30 Jan
              • Re: next insert id (slightly OT)William R. Mussatto30 Jan