© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Team•3y ago•
11 replies
PapaFinn

Does Drizzle support MySQL's LAST_INSERT_ID function?

I'm wanting to return a newly created record in the db immediately after a POST. MySQL doesn't support
returning
returning
so it seems the alternative is a separate request in the same transaction that fetches the new record. It appears that the easiest way to do this is with MySQL's
LAST_INSERT_ID
LAST_INSERT_ID
function. Does Drizzle support this or does this have to be done with raw SQL?
Drizzle TeamJoin
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
11,879Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

get last inserted id with mysql
Drizzle TeamDTDrizzle Team / help
3y ago
Does drizzle support querying across multiple mysql databases (same mysql server)?
Drizzle TeamDTDrizzle Team / help
2y ago
drizzle-zod insert user without id
Drizzle TeamDTDrizzle Team / help
3y ago
Does Drizzle support using INSERT statements in a WITH clause?
Drizzle TeamDTDrizzle Team / help
2y ago