Tim Krah wrote:
Am Montag, 9. Februar 2004 15:44 schrieb D. Richard Hipp:

Yes, it is a bug.  It has been around for ages (since
version 2.4.0, 2002-March-11) but you are the first
to notice it.


Hi,

I think I've found another Bug with subqueries (it seems not widely spread using subselects for I am the first to notice?):

The GROUP BY clause works fine if you have an aggregate function in the result set. It isn't clear to me why you would want to use a GROUP BY clause otherwise. I'll enter this bug, but it is going to be a very low priority, therefore.


SQLite version 2.8.12 Enter ".help" for instructions sqlite> .echo on sqlite> .read test.sql .read test.sql drop table t1; create table t1 ( a INTEGER PRIMARY KEY, b INTEGER, c INTEGER );

INSERT INTO t1 VALUES (1,1,1);
INSERT INTO t1 VALUES (2,1,2);
INSERT INTO t1 VALUES (3,1,3);
INSERT INTO t1 VALUES (4,1,1);
INSERT INTO t1 VALUES (5,1,2);
INSERT INTO t1 VALUES (6,1,3);
INSERT INTO t1 VALUES (7,2,1);
INSERT INTO t1 VALUES (8,2,2);
INSERT INTO t1 VALUES (9,2,3);

--this select works as expected
SELECT  b,
        c
        FROM t1
        GROUP BY b, c
        ORDER BY b, c DESC
;
b           c
----------  ----------
1           3
1           2
1           1
2           3
2           2
2           1

--this select gets screwed up
SELECT * FROM (
SELECT  b,
        c
        FROM t1
        GROUP BY b, c
        ORDER BY b, c DESC
);
b           c
----------  ----------
1           3
1           3
1           2
1           2
1           1
1           1
2           3
2           2
2           1
sqlite>


Tim Krah



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]





-- D. Richard Hipp -- [EMAIL PROTECTED] -- 704.948.4565


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to