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 Limit:In the LIMIT clause, you can select a specific number of rows starting from a specific position using the OFFSET clause. For example, “LIMIT 4 OFFSET 4” will ignore the first 4 rows, and returned 4 rows starting from the fifth rows, so you will get rows 5,6,7, and 8.
Maximum Database SizeThe maximum size of a database file is 4294967294 pages. At the maximum page size of 65536 bytes, this translates into a maximum database size of approximately 1.4e+14 bytes (281 terabytes, or 256 tebibytes, or 281474 gigabytes or 256,000 gibibytes).
You use the LIMIT clause to constrain the number of rows returned by the query. For example, a SELECT statement may return one million rows. However, if you just need the first 10 rows in the result set, you can add the LIMIT clause to the SELECT statement to retrieve 10 rows.
The OFFSET LIMIT clause is an optional clause to skip then take some number of values from the query. The OFFSET count and the LIMIT count are required in the OFFSET LIMIT clause. When OFFSET LIMIT is used in conjunction with an ORDER BY clause, the result set is produced by doing skip and take on the ordered values.
Just set LIMIT to -1.
For example:
SELECT * FROM table LIMIT -1 OFFSET 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With