Re: raport w rozbiciu na stawki
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: 1. from_unixtime() nie ma w postgresie i sqlite (ale można dorobić) 2. w sqlite trzeba dorobić floor (ale to pryszcz)
uczestnicy (1)
-
A.L.E.C