Subject | RE: [firebird-support] SUM, group by |
---|---|
Author | Alan McDonald |
Post date | 2004-10-10T21:28:57Z |
> Hello,try
>
> I have following select statement, which reports me an error (error
> code -104, invalid expression in the select list):
>
> select Field1,Field2, Field3,
> SUM(Field4) as SField4,
> SUM(Field5) as SField5,
> SUM(Field6) as SField6
> from TABLE
> group by Field1
> order by Field1
>
>
> I want to get a sum of fields 4,5,6 for each of Field1.
>
> What am I missing here ?
>
>
>
> Regards,
> Primoz
> select Field1,Field2, Field3,there's no need for order by - group by does it for you anyway
> SUM(Field4) as SField4,
> SUM(Field5) as SField5,
> SUM(Field6) as SField6
> from TABLE
> group by Field1, field2, field3
Alan