如何从表中获取最后一个插入ID [英] How to get the last insert ID from a table
本文介绍了如何从表中获取最后一个插入ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想获取表中最后一个ID插入的值。我该怎么做?
I want to get the value of the last ID insert in a table. How I can do this?
推荐答案
我使用的解决方案是:
select id from NEW TABLE (insert into (val1, val2, ...) values ('lorem', 'ipsum', ...))
这将从插入数据库的最后一行获取id列:)
This gets the id column from the last row inserted in the DB :)
这篇关于如何从表中获取最后一个插入ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文