I am using following query which works fine for me except one problem
SELECT f.period as month,
sum(p.revenue * ((100-q.rate)/100)) as revenue,
count(distinct q.label) as tot_stmt
FROM files f, reports p, rates q,albums a
WHERE f.period in ('2010-06-01','2010-05-01','2010-04-01','2010-03-01')
AND f.period_closed = true
AND q.period = f.period
AND a.id = q.album_id
AND p.file_id = f.id
AND p.upc = a.upc
AND p.revenue is not null
GROUP BY month ORDER BY month DESC
O/P =>
month revenue tot_stmt
2010-06-01 10.00 2
2010-05-01 340.47 2
I want result like following
month revenue tot_stmt
2010-06-01 10.00 2
2010-05-01 340.47 2
2010-04-01 0.00 0
2010-03-01 0.00 0