postgresql
aeaheahe!!
brainfuck select:
Code
SELECT
(v.cpm>0,sum(v.opened_count/1000.0*v.cpm),(s.total+s.pending)*(1-sm.share)) AS value,
sum(v.opened_count) AS opened, sum(s.total) as total,
sum(s.pending) as pending,
(s.presented<>NULL,cast(s.presented as date),cast(v.delivery as date)) as day
FROM affiliate_sale_statistics s, site_statistics v, sitemedias sm
WHERE v.delivery>=timestamp '2011-01-01' AND v.delivery<timestamp '2011-02-01' AND s.presented>=timestamp '2011-01-01' AND s.presented<timestamp '2011-02-01' AND sm.id=v.sitemedia_id
GROUP BY day ORDER BY day ASC;
problem is der "day" teil glaub ich
hm okay, damit hätt ich nu nicht gerechnet... aber CAST ist bei dem ja ein integer, day ist halt datum...