Yes, I see that now and understand the difference between sum(iif and iif(sum. Alan
Alan J Davies Aldis On 15/11/2014 11:50, Svein Erling Tysvær [email protected] [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 > > ------------------------------------ ------------------------------------ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Visit http://www.firebirdsql.org and click the Documentation item on the main (top) menu. Try FAQ and other links from the left-side menu there. Also search the knowledgebases at http://www.ibphoenix.com/resources/documents/ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ------------------------------------ Yahoo Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/firebird-support/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/firebird-support/join (Yahoo! ID required) <*> To change settings via email: [email protected] [email protected] <*> To unsubscribe from this group, send an email to: [email protected] <*> Your use of Yahoo Groups is subject to: https://info.yahoo.com/legal/us/yahoo/utos/terms/
