开发者

SQLite select x-th row

开发者 https://www.devze.com 2023-03-14 20:35 出处:网络
let\'s suppose I have this table, where I deleted the row with rowid=3: rowid | something ------+-----------

let's suppose I have this table, where I deleted the row with rowid=3:

rowid | something
------+-----------
    开发者_JAVA技巧1 | ...
    2 | ...
    4 | ...
    5 | ...

How to select the third row (the one with rowid=4) ?


select * from table limit 2,1

Means something like "start from index 2 and return 1 row."


select * from yourtable order by rowid limit 1 offset 2;

Will get you the third row in that sorted result set (offset is 0-based).


select Max(row_id) from ( select * from table_name limit 3)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号