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
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
svein.erling.tysv...@kreftregisteret.no [firebird-support] wrote:
Thank you Svein, that's what I tried but kept getting:
SQL error code = -104.
for select
iif(n.code=1,sum(n.amount),0),
iif(n.code=2,sum(n.amount),0),
iif(n.code=3,sum(n.amount),0),
n.sell_date
from new_table n
where n.sell_date between :fromdate and :uptodate
group by n.sell_date,n.code
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
Hi, I have a question about summing data, as follows:
NEW_TABLE
CODEAMOUNT SELL_DATE
1 10 10.11.2014
2 20 10.11.2014
3 30 07.11.2014
1 100 11.11.2014
2 200 11.11.2014
2 200011.11.2014
1 150 10.11.2014
3 500