Subject | Re: [firebird-support] SUM, group by |
---|---|
Author | xyvy |
Post date | 2004-10-10T21:30:01Z |
Please execute this:
select Field1, SUM(Field4) as SField4, SUM(Field5) as SField5, SUM(Field6) as SField6
from TABLE
group by Field1
order by Field1
or
select Field1, Field2, Field3, SUM(Field4) as SField4, SUM(Field5) as SField5, SUM(Field6) as SField6
from TABLE
group by Field1, Field2, Field3
order by Field1
The problem is that you only must to use GROUP BY fields or AGGREGATE
fields, but in your query Field2 and Field3 they are not GROUP BY or
AGGREGATE fields, do you understand ?
Ciao.
Jose Velasco.
select Field1, SUM(Field4) as SField4, SUM(Field5) as SField5, SUM(Field6) as SField6
from TABLE
group by Field1
order by Field1
or
select Field1, Field2, Field3, SUM(Field4) as SField4, SUM(Field5) as SField5, SUM(Field6) as SField6
from TABLE
group by Field1, Field2, Field3
order by Field1
The problem is that you only must to use GROUP BY fields or AGGREGATE
fields, but in your query Field2 and Field3 they are not GROUP BY or
AGGREGATE fields, do you understand ?
Ciao.
Jose Velasco.