nie przejdzie, a tak pójdzie: select floor(time/86400) as date, sum(case taxvalue when 22.00 then value else 0 end) as tax22, sum(case taxvalue when 7.00 then value else 0 end) as tax7, sum(case taxvalue when 0.00 then value else 0 end) as tax0, sum(case taxvalue when NULL then value else 0 end) as taxfree from cash where type=3 group by date order by date
i parę uwag:
- from_unixtime() nie ma w postgresie i sqlite (ale można dorobić)
- w sqlite trzeba dorobić floor (ale to pryszcz)
oops, poprawka - ostatni case nie działał, to będzie działać na wszystkich bazach select floor(time/86400) as date, sum(case taxvalue when 22.00 then value else 0 end) as tax22, sum(case taxvalue when 7.00 then value else 0 end) as tax7, sum(case taxvalue when 0.00 then value else 0 end) as tax0, sum(case when taxvalue IS NULL then value else 0 end) as taxfree from cash where type=3 group by date order by date
Pozdrawiam Aleksander Machniak ( A.L.E.C ) http://alec.k27.prv.pl GG-2275252
uczestnicy (1)
-
A.L.E.C