How to get Last record from Sqlite?

前端 未结 12 2073
悲&欢浪女
悲&欢浪女 2020-12-02 07:37

I have a one table question_table and one ImageButton (Back). I need to get the last inserted record from the database after clicking on t

12条回答
  •  遥遥无期
    2020-12-02 08:32

    in sqlite, there is a table called sqlite_sequence, this table contains the table name and it's last id number (if the id is auto incremented).

    So, to get the last row in a table just put :

    Select * from TABLENAME where id=(SELECT * from sqlite_sequence where name ='TABLENAME')
    

提交回复
热议问题