SQLite Forum

select in order
Login
Pretend I were stupid and explain the obvious reasons.

Begin by stating the programming language you are using and the schema of your table and any associated indeces.

Then answer the question I already asked: Where does the list of ids come from?

You must already be prepared to handle the case of deleted rows. Pretend only odd ids exist. What happens when you expect record 2 but you get record 5 instead? What happens when there are no morw rows in the result set but you still have ids in your list?

Surely there must exist a way of linking a row of data with the id used to retrieve it. And even if all you have is pipes connected to the input and output streams of a process running the SQLite shell program, you can always delimit the result set witg "guard queries", e.g.:

select 'BEGIN_QUERY_1';
<your query>
select 'END_QUERY_1';