【问题标题】:SQLite: Retrieve whats just been added?SQLite:检索刚刚添加的内容?
【发布时间】:2012-05-30 16:14:26
【问题描述】:

我有一个自动递增的 ID 字段。我想做的是在完成 INSERT 命令后检索分配给此 ID 字段的值。

谁能告诉我怎么做?

谢谢

【问题讨论】:

    标签: sqlite auto-increment


    【解决方案1】:

    你想要last_insert_rowid():

    SELECT last_insert_rowid();
    

    【讨论】:

    • 酷!我会在可能的时候接受你的回答。这对我很有用:SELECT * from Table where ID=last_insert_rowid()
    猜你喜欢
    • 2013-03-31
    • 1970-01-01
    • 1970-01-01
    • 2017-03-10
    • 2011-01-27
    • 2018-10-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多