Subject Re: [firebird-support] sum data into single row per day
Author Alan J Davies
Thank you Svein, that's what I tried but kept getting:
SQL error code = -104.
Invalid expression in the select list (not contained in either an
aggregate function or the GROUP BY clause).

and yet it now works. I thought it must have been because I was
accessing code in the iif(...). I must have had a typo that I could not
see for looking. Anyway, that now works perfectly, without the ',' after SH.

Alan J Davies

On 14/11/2014 08:41, Svein Erling Tysvær
svein.erling.tysvaer@... [firebird-support] wrote:
> select sell_date,
> sum(iif(code=1, amount,0)) stock,
> sum(iif(code=2, amount,0)) repair,
> sum(iif(code=3, amount,0)) SH,
> from new_table
> where n.sell_date between :fromdate and :uptodate
> group by sell_date