In the last episode (Sep 19), Steven Kreuzer said:
> >What is the SQL to get the created AutoInc ID from a row that I have
> >just inserted?
>
> SELECT MAX(id_field) FROM table

Nope.  If someone else inserted a record between the time you inserted
yours and the time you run that select, your answer will be wrong. 
Use LAST_INSERT_ID(), or whatever construct your language provides for
retrieving it without doing another query.

-- 
        Dan Nelson
        [EMAIL PROTECTED]

---------------------------------------------------------------------
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 <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to