List:General Discussion« Previous MessageNext Message »
From:Michael Tam Date:September 19 2002 5:46pm
Subject:RE: Auto Increment ID of Inserted Row
View as plain text  
I believe this approach work in a single connection environment and it has a
potential problem when it is running in a concurrent system.
  
What happens if there is another insert occurred through another connection
just before this statement being executed??
The result of this statement would not be id you are expecting.

Regards,
Michael

-----Original Message-----
From: Steven Kreuzer [mailto:skreuzer@stripped]
Sent: Thursday, September 19, 2002 10:24 AM
To: Davis, Tim
Cc: Mysql (E-mail)
Subject: Re: Auto Increment ID of Inserted Row


SELECT MAX(id_field) FROM table

SK

On Thursday, September 19, 2002, at 12:55 PM, Davis, Tim wrote:

> What is the SQL to get the created AutoInc ID from a row that I have 
> just
> inserted?
>
> Tim Davis
> Sunbelt Systems Concepts, Inc
> twdavis@stripped
> Client/Server Database Programmer/Analyst
>
>
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
> To request this thread, e-mail <mysql-thread120057@stripped>
> To unsubscribe, e-mail 
> <mysql-unsubscribe-skreuzer=mac.com@stripped>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <mysql-thread120064@stripped>
To unsubscribe, e-mail
<mysql-unsubscribe-mtam=pfc.forestry.ca@stripped>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Thread
Auto Increment ID of Inserted RowTim Davis19 Sep
  • Re: Auto Increment ID of Inserted RowPaul DuBois19 Sep
  • Re: Auto Increment ID of Inserted RowSteven Kreuzer19 Sep
    • Re: Auto Increment ID of Inserted RowPaul DuBois19 Sep
    • Re: Auto Increment ID of Inserted RowRodney Broom19 Sep
    • Re: Auto Increment ID of Inserted RowDan Nelson19 Sep
RE: Auto Increment ID of Inserted RowMichael Tam19 Sep