Re: [sqlite] Bug report: ORDER BY ignored in presence of GROUP BY and index

2014-04-20 Thread Richard Hipp
On Sat, Apr 19, 2014 at 11:14 PM, foxlit wrote: > Hi, > > I recently noticed something similar to the following behaviour: > > sqlite> .version > SQLite 3.8.4.3 2014-04-03 16:53:12 a611fa96c4a848614efe899130359c9f6fb889c3 > sqlite> CREATE TABLE t1 (x, y); > sqlite>

[sqlite] Bug report: ORDER BY ignored in presence of GROUP BY and index

2014-04-20 Thread foxlit
Hi, I recently noticed something similar to the following behaviour: sqlite> .version SQLite 3.8.4.3 2014-04-03 16:53:12 a611fa96c4a848614efe899130359c9f6fb889c3 sqlite> CREATE TABLE t1 (x, y); sqlite> INSERT INTO t1 VALUES (1, 1), (2, 0); sqlite> SELECT x, y FROM t1 GROUP BY x, y ORDER BY x,y;

AW: [sqlite] bug in ORDER BY ?

2005-04-14 Thread Christian Schwarz
Does "select * from mactor order by id desc limit 1" and "select * from mactor order by id limit 1" not work? Greetings, Christian

Re: [sqlite] bug in ORDER BY ?

2005-04-14 Thread Thomas Steffen
On 4/14/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > EXPLAIN is your friend. As can be seen by EXPLAINing each query (see below), > there are fewer instructions involved in the one with the subquery, and no > sorts or loops as are done in the initial method. Well, not everybody is a

Re: [sqlite] bug in ORDER BY ?

2005-04-14 Thread Derrell . Lipman
Thomas Steffen <[EMAIL PROTECTED]> writes: > On 4/14/05, [EMAIL PROTECTED] > <[EMAIL PROTECTED]> wrote: >> How about these: >> >> SELECT * from Mactor WHERE id = (SELECT MAX(id) FROM Mactor); >> SELECT * from Mactor WHERE id = (SELECT MIN(id) FROM Mactor); > > I am working on a similar

Re: [sqlite] bug in ORDER BY ?

2005-04-14 Thread Thomas Steffen
On 4/14/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > How about these: > > SELECT * from Mactor WHERE id = (SELECT MAX(id) FROM Mactor); > SELECT * from Mactor WHERE id = (SELECT MIN(id) FROM Mactor); I am working on a similar problem at the moment, but unless I missed something, ORDER

Re: [sqlite] bug in ORDER BY ?

2005-04-14 Thread Derrell . Lipman
"Miha Vrhovnik"<[EMAIL PROTECTED]> writes: > SELECT * FROM Mactor WHERE id < 9223372036854775807 ORDER BY id DESC LIMIT 1; > > where 9223372036854775807 is Maximum value of signed Int64. > > P.S. If anybody has better Idea of how to get the last/first row (the one > with highest/lowest ID) then

Re: [sqlite] bug in ORDER BY ?

2005-04-14 Thread Xavier Aguila
try SELECT * FROM Mactor WHERE id=(Select max(id) from Mactor); //with this you get last id. SELECT * FROM Mactor WHERE id=(Select min(id) from Mactor); //with this you get first id. Xavier Miha Vrhovnik wrote: Hi, sqlite dll is 3.2.1 I have the folowing query: SELECT * FROM Mactor WHERE id <

[sqlite] bug in ORDER BY ?

2005-04-14 Thread Miha Vrhovnik
Hi, sqlite dll is 3.2.1 I have the folowing query: SELECT * FROM Mactor WHERE id < 9223372036854775807 ORDER BY id DESC LIMIT 1; where 9223372036854775807 is Maximum value of signed Int64. Table is defined as: CREATE TABLE Mactor ( id INTEGER PRIMARY KEY, name TEXT, birthName TEXT, birthday