At 06:34 AM 9/1/03, aka MacGuru wrote:
>Anyone knows how to obtain last inserted serial (autoincrement) id? I am
>currently using "SELECT id FROM table_name ORDER BY id DESC", and then
>retrieve first row and desired value.
Faster then your version:
SELECT id FROM table_name ORDER BY id DESC LIMIT 1
The 'elegant' solution:
SELECT currval('tablename_sequence_id');