KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I was reviewing a Drupal module when I found this pattern for getting the id of the row last inserted: SELECT MAX(id) FROM ... WHERE ... where the id is a field working in a usual autoincrement way. Is this conceptually right to do? Is there any situation when this pattern will fail in a MySQL/PostgreSQL environment? Edit: Thanks for the excellent comments and answers! I should clarify my question: I meant a situation where someone would like to find out the id of the last inserted row regardless of the session .
Tags (comma-separated)
Save Edits
Cancel