RE: [firebird-support] sum data into single row per day

2014-11-15 Thread Svein Erling Tysvær svein.erling.tysv...@kreftregisteret.no [firebird-support]
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

Re: [firebird-support] sum data into single row per day

2014-11-15 Thread Alan J Davies alan.dav...@aldis-systems.co.uk [firebird-support]
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.

RE: [firebird-support] sum data into single row per day

2014-11-14 Thread Svein Erling Tysvær svein.erling.tysv...@kreftregisteret.no [firebird-support]
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

Re: [firebird-support] sum data into single row per day

2014-11-14 Thread Alan J Davies alan.dav...@aldis-systems.co.uk [firebird-support]
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

[firebird-support] sum data into single row per day

2014-11-13 Thread Alan J Davies alan.dav...@aldis-systems.co.uk [firebird-support]
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