SQLite with skip (offset) only (not limit)

2019-01-24 01:39发布

I am trying to query a sql lite database with only an offset and no limit.

SELECT [Id], [Name], [IntValue], [IntNulableValue] FROM [Product] OFFSET 10

I can do an offset query when I have a limit however (LIMIT 10 OFFSET 10).

Here is the error sql lite is giving me.

SQLite error near "10": syntax error

标签: sqlite offset
2条回答
【Aperson】
2楼-- · 2019-01-24 02:10

On the SQL as understood by SQLite page, you'll notice that OFFSET isn't understood without LIMIT.

http://sqlite.org/lang_select.html

According to the same documentation:

If the LIMIT expression evaluates to a negative value, then there is no upper bound on the number of rows returned.

查看更多
兄弟一词,经得起流年.
3楼-- · 2019-01-24 02:18

Just set LIMIT to -1.

For example:

SELECT * FROM table LIMIT -1 OFFSET 10
查看更多
登录 后发表回答