Re: [sqlite] SQL question - not sure if it's possible at all

2009-05-28 Thread Dennis Volodomanov
Igor Tandetnik wrote: > Well, there's no way to tell how records with the same Date are going to > end up ordered in the original query. If you impose some deterministic > order there, e.g. with > > ORDER BY Date, Id > > then you can do something like this: > > select count(*) > from Data d, (sel

Re: [sqlite] SQL question - not sure if it's possible at all

2009-05-28 Thread Igor Tandetnik
"Dennis Volodomanov" wrote in message news:4a1e80dd.9040...@psunrise.com > Igor Tandetnik wrote: >>> 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 D

Re: [sqlite] SQL question - not sure if it's possible at all

2009-05-28 Thread Dennis Volodomanov
Igor Tandetnik wrote: >> 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=?);

[sqlite] SQL question - not sure if it's possible at all

2009-05-28 Thread Dennis Volodomanov
Hello all, I'm not sure if this can be done in SQL, but if it can, I'd appreciate your help. Let's say I've got this query: SELECT * FROM (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 f

Re: [sqlite] SQL question - not sure if it's possible at all

2009-05-27 Thread Dennis Volodomanov
Igor Tandetnik wrote: > Dennis Volodomanov 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 >

Re: [sqlite] SQL question - not sure if it's possible at all

2009-05-27 Thread Igor Tandetnik
Dennis Volodomanov 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 a

[sqlite] SQL question - not sure if it's possible at all

2009-05-27 Thread Dennis Volodomanov
Hello all, I'm not sure if this can be done in SQL, but if it can, I'd appreciate your help. Let's say I've got this query: SELECT * FROM (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 f