On Fri, 9 Apr 2004 18:51:54 +0200, A.L.E.C wrote
To już w pełni rozbija na stawki: select from_unixtime(time, "%Y.%m.%d") as date, sum(if(cash.taxvalue=22.00,value,0)) as tax22, sum(if(cash.taxvalue=7.00,value,0)) as tax7, sum(if(cash.taxvalue=0.00,value,0)) as tax0, sum(if(cash.taxvalue is NULL,value,0)) as taxfree from cash where type=3 group by date order by date;
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)
Super, dzięki za podpowiedź! :)
Pozdrawiam Aleksander Machniak ( A.L.E.C ) http://alec.k27.prv.pl GG-2275252
Pozdrawiam Tomasz Chiliński
uczestnicy (1)
-
Tomasz Chilinski