How to get the last insert ID from a table

后端 未结 4 906
臣服心动
臣服心动 2021-02-18 15:14

I want to get the value of the last ID insert in a table. How I can do this?

4条回答
  •  情深已故
    2021-02-18 15:30

    Well the solution that I use is:

    select id from NEW TABLE (insert into (val1, val2, ...) values ('lorem', 'ipsum', ...))
    

    This gets the id column from the last row inserted in the DB :)

提交回复
热议问题