The original question that started this thread was:
>>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?
To which I replied:
>You can't find out what it *will be* until you actually create the record.
>Then you get the like this:
>Check the discussion for LAST_INSERT_ID() in the MySQL manual.
>It will tell you the answer to your next question. :-)
When I wrote that last sentence, I was anticipating that the original
poster would ask, "but what happens if other clients insert records
and generate new AUTO_INCREMENT values? Won't that cause the value
returned by LAST_INSERT_ID() to become invalid?"
The answer, of course, is no. LAST_INSERT_ID() is designed specifically
*not* to be affected by activity performed by other clients. It's all
spelled out in the manual. If you don't believe it (and from the amount
of traffic that this thread has generated, apparently many people do not),
here's the reference:
LAST_INSERT_ID() is your friend. Get to know it, it won't let you down. :-)