Can someone explain why this sqlite3 query will work and return my 1000 records:
SELECT * FROM fmsdata LIMIT 1000 OFFSET (SELECT COUNT(*) FROM fmsdata) - 1000
but the minute I drop in the where clause WHERE valve=3
it returns nothing?
SELECT * FROM fmsdata WHERE valve=3 LIMIT 1000 OFFSET (SELECT COUNT(*) FROM fmsdata) - 1000
This sub query returns the table size which is 123290.
SELECT COUNT(*) FROM fmsdata
FYI the offset is just to quickly give me the tail end of the database without having to sort anything since I know the latest records will always be at the end.
Here is a successful query without the where clause:
Our test table has records looping roughly around 102 valves so with a limit of 1000 we should have at least 9 entries that showed up at the tail end of the query.
Not sure if it matters but I am on a Ubuntu 18.04 system.