On Fri, Oct 28, 2011 at 06:42:06PM +0200, Tobias Sj??sten scratched on the wall:
> I have a table:
>
> CREATE TABLE t
> (
> i INT,
> g VARCHAR(1),
> v INT
> );
> But when I group it by 'g' it completely disregards the ordering:
>
> > SELECT g,v FROM t GROUP BY g ORDER BY v ASC;
> a|3
> b|3
>
>
@sqlite.org
Subject: [sqlite] ORDER BY disregarded for GROUP BY
I have a table:
CREATE TABLE t
(
i INT,
g VARCHAR(1),
v INT
);
And the data:
INSERT INTO t (i,g,v) VALUES (1,'a',2);
INSERT INTO t (i,g,v) VALUES (1,'a',1);
INSERT INTO t (i,g,v) VALUES (1,'a',3);
INSERT INTO t (i,g,v) VALUES (1,'b',2
On 10/28/2011 12:42 PM, Tobias Sjösten wrote:
But when I group it by 'g' it completely disregards the ordering:
SELECT g,v FROM t GROUP BY g ORDER BY v ASC;
a|3
b|3
What seems to be the problem? The resultset is ordered by the second
column, isn't it? What did you expect to happen
I have a table:
CREATE TABLE t
(
i INT,
g VARCHAR(1),
v INT
);
And the data:
INSERT INTO t (i,g,v) VALUES (1,'a',2);
INSERT INTO t (i,g,v) VALUES (1,'a',1);
INSERT INTO t (i,g,v) VALUES (1,'a',3);
INSERT INTO t (i,g,v) VALUES (1,'b',2);
INSERT INTO t (i,g,v) VALUES (1,'b',1);
INSERT INTO t
4 matches
Mail list logo