Subject Re: [firebird-support] sum data into single row per day
Author Alan J Davies
Yes, I see that now and understand the difference between sum(iif and

Alan J Davies

On 15/11/2014 11:50, Svein Erling Tysvær
svein.erling.tysvaer@... [firebird-support] wrote:
> >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.
> Sorry about not removing the comma after copying. I think your error
> might have been doing IIF(SUM... rather than SUM(IIF... Logically, that
> is using an aggregate to decide which single value to return (and hence,
> needs to be grouped by), whereas SUM(IIF takes a single value to
> determine which value should be used in the aggregation and doesn't need
> aggregation. When I try IIF(SUM..., I do get -104 as well.
> Set