Hi, I have the following query:
select c.CUSTOMERNO, dm.INVOICEMONTH,
sum(dm.PRODUCTCOUNT1) as PORTAL_VOL
from debmonthly dm, monitororder mo, customer c, employee e
where mo.ORDERNO = dm.ORDERNO
and mo.CUSTOMERNO = c.CUSTOMERNO
and c.SALESPERSONID = e.USERID
and c.SALESPERSONID in (3961,1074,5122)
and dm.PRODUCTNO in (8285,1287,2287,3287,1387,2387,3387,1289)
group by c.CUSTOMERNO, dm.INVOICEMONTH,
which provides the following example results:
CUSTOMERNO INVOICEMONTH PORTAL_VOL
1 May 2004 10
1 Jun 2004 15
2 May 2004 50
2 Jun 2004 75
2 Jul 2004 100
3 Jun 2004 5
etc...
I want to be able to have another column within the same result set showing different product volumes, i.e.:
CUSTOMERNO INVOICEMONTH EMAIL_VOL FAX_VOL
1 May 2004 10 2
1 Jun 2004 15 0
1 Jul 2004 0 10
2 May 2004 50 5
2 Jun 2004 75 0
2 Jul 2004 100 10
3 May 2004 0 25
3 Jun 2004 5 0
etc...
How can I acheive this?