I love the LAST_INSERT_ID() function of MySQL. I use it all the time to retrieve the id of the just inserted row to return from my stored procedure afterwards. However, now I have a table which has a TIMESTAMP as Primary Key that is set to DEFAULT CURRENT_TIMESTAMP. How can I retrieve this last inserted timestamp?
This should do it safely:
START TRANSACTION;
{do your insert};
SELECT MAX({timestamp field}) FROM {table};
COMMIT;