no skúsil som toto
Kód:
select t.id,
sum(if (week(t.dat='18', t.pocet, 0))-sum(if (week(t.dat)='17', t.dat, 0)) as 'week_18',
sum(if (week(t.dat='19', t.pocet, 0))-sum(if (week(t.dat)='18', t.dat, 0)) as 'week_19'
from table1 t
group by t.id
neviem či je to celkom najčistejšie rešenie ale dostanem to čo potrebujem
problém je len ako generovať
Kód:
sum(if (week(t.dat='18', t.pocet, 0))-sum(if (week(t.dat)='17', t.dat, 0)) as 'week_18',
sum(if (week(t.dat='19', t.pocet, 0))-sum(if (week(t.dat)='18', t.dat, 0)) as 'week_19',
.....
potrebujem zistiť počet týždňom a potom v nejakom cykle to gerovať ?!?
