Dennis Volodomanov <i...@psunrise.com> wrote:
> Let's say I've got this query:
>
> SELECT * FROM (SELECT * FROM Data WHERE PlotOnGraph=1 ORDER BY Date
> ASC) LIMIT ?2 OFFSET ?1

Why an extra layer? Why not just

SELECT * FROM Data WHERE PlotOnGraph=1 ORDER BY Date ASC
LIMIT ?2 OFFSET ?1

> and let's say, "Data" has an "ID" field (primary index).
>
> Is it possible to find out the *position* in the returned result set
> of a Data with a given ID?

select count(*) from Data
where PlotOnGraph=1
    and Date < (select Date from Data where ID=?);

Igor Tandetnik 



_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to