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?
2 Replies
You can
console.log(data)
I belive it's insertedId
thanks, I didn't spot it because thought it would be directly on the data object and it didn't show up on the types autocomplete. For anybody else looking for mySQl it's