Djelf wrote:
> SQLSTATE[42803]: Grouping error: 7 ERROR: column "t.v3" must appear in the
> GROUP BY clause or be used in an aggregate function
>
> It seems to me that sqlite should issue a similar message.
This is allowed for compatibility with MySQL.
And there is a case with min()/max() where
I understood what's the matter. The query was incorrect.
I tested this on posgresql.
SQLSTATE[42803]: Grouping error: 7 ERROR: column "t.v3" must appear in the
GROUP BY clause or be used in an aggregate function
It seems to me that sqlite should issue a similar message.
Correct query is
Djelf wrote:
> INSERT INTO t (v1,v2,v3,v4) VALUES
> (1,1,1,0),(1,1,0,1),(2,1,0,10),(3,1,0,100),(3,1,0,1000);
>
> SELECT
> v1,v2,sum(v3+v4) OVER (PARTITION BY v2 ORDER BY v1) as val
> FROM t
> GROUP BY v1,v2;
>
> v1v2 val
> 1 1 1
> 2 1 10010
> 3 1
Hi!
Maybe I do not understand something, but does it really have to work this
way?
DROP TABLE IF EXISTS t;
CREATE TABLE t (v1,v2,v3,v4);
INSERT INTO t (v1,v2,v3,v4) VALUES
(1,1,1,0),(1,1,0,1),(2,1,0,10),(3,1,0,100),(3,1,0,1000);
SELECT
v1,v2,sum(v3+v4) OVER (PARTITION BY v2 ORDER
4 matches
Mail list logo