Evert
Evert

Reputation: 3

Sqlite order of query

I'm running this query on a sqlite db and it looks that its working fine.

SELECT batterij ,timestamp FROM temphobbykamer WHERE nodeid= 113 AND timestamp >= 1527889336634 AND timestamp <= 1530481336634 AND ROWID % 20 =0

But can i be sure that the query is handled in the correct order?

It must find all records from node113 between time A and B. From this selection found I only want to have every 20th record. I can imagine if the query order difference, that if you query every 20th record between time A and B and select from this selection all the node113 records that the response will be different.

Upvotes: 0

Views: 22

Answers (1)

Joel Lucsy
Joel Lucsy

Reputation: 8706

When no ORDER BY is specified, the order is undefined. However, typically sqlite will return in ROWID order since you haven't specified anything else. To make sure you get consistent results, you should specify ORDER BY ROWID

Upvotes: 1

Related Questions