Search
Star
Feedback
Setup for Free
© 2026 Hedgehog Software, LLC
Twitter
GitHub
Discord
System
Light
Dark
More
Communities
Docs
About
Terms
Privacy
get last inserted id with mysql - Drizzle Team
DT
Drizzle Team
•
3y ago
•
3 replies
CharlesCharlieCharles
get last inserted id with mysql
noob question
, but what is the preffered way to get the last inserted id using mysql
?
const data
= await db
.insert
(brand
)
.values
(brandInsert
)
const lastId
=
?
?
thanks
?
Drizzle Team
Join
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
11,879
Members
View on Discord
Resources
ModelContextProtocol
ModelContextProtocol
MCP Server
Similar Threads
Was this page helpful?
Yes
No
Similar Threads
Get `id` of inserted row
DT
Drizzle Team / help
3y ago
Does Drizzle support MySQL's LAST_INSERT_ID function?
DT
Drizzle Team / help
3y ago
Fetching id from recently inserted data
DT
Drizzle Team / help
2y ago
MySQL varchar gets inferred as MySqlText?
DT
Drizzle Team / help
3y ago