would you please check this for me?
From: Totti <saliba.toufic.george_at_gmail.com>
Date: Thu, 3 Jan 2008 12:43:21 -0800 (PST)
Message-ID: <4961ad49-a112-49e2-a7a4-d054815ddd54@e6g2000prf.googlegroups.com>
Month Year SP-20.2 SP-20.1 SP-20.6
SELECT TO_CHAR(purinv.Inv_Date,'mm')
MONTH ,TO_CHAR(purinv.Inv_Date,'YYYY') YEAR, (case when purch.Prod_Code = 'SP-20.2' then sum(nvl(purch.qty,0)) else sum(0) end SP-20.2,
case when purch.Prod_Code = 'SP-20.1' then sum(nvl(purch.qty,0)) else sum(0) end SP-20.1,
case when purch.Prod_Code = 'SP-20.6' then sum(nvl(purch.qty,0)) else sum(0)end SP-20.6)
from purinv, purch
where purinv.Code = purch.Inv_Code and purch.Prod_Code in ('SP-20.2', 'SP-20.1', 'SP-20.6')
Date: Thu, 3 Jan 2008 12:43:21 -0800 (PST)
Message-ID: <4961ad49-a112-49e2-a7a4-d054815ddd54@e6g2000prf.googlegroups.com>
hi all, i ve been struggeling with this function and i can not see
what is the problem.
i am using it for getting the following result:
Month Year SP-20.2 SP-20.1 SP-20.6
----- --- ---------- ---------- ---------- 01 1998 400 140 80 02 1998 0 0 0 03 1998 0 0 99 04 1998 0 163 0 05 1998 420 0 90 06 1998 0 0 0 07 1998 0 155 88 08 1998 0 151 85 09 1998 481 145 81 10 1998 0 0 0 11 1998 0 0 110 12 1998 0 0 0 01 1999 0 0 89 02 1999 456 163 86 03 1999 0 0 81 04 1999 0 0 0 05 1999 0 162 87 06 1999 413 0 90 07 1999 0 0 0and the formula is:
**********************************************************************************************************
SELECT TO_CHAR(purinv.Inv_Date,'mm')
MONTH ,TO_CHAR(purinv.Inv_Date,'YYYY') YEAR, (case when purch.Prod_Code = 'SP-20.2' then sum(nvl(purch.qty,0)) else sum(0) end SP-20.2,
case when purch.Prod_Code = 'SP-20.1' then sum(nvl(purch.qty,0)) else sum(0) end SP-20.1,
case when purch.Prod_Code = 'SP-20.6' then sum(nvl(purch.qty,0)) else sum(0)end SP-20.6)
from purinv, purch
where purinv.Code = purch.Inv_Code and purch.Prod_Code in ('SP-20.2', 'SP-20.1', 'SP-20.6')
group by TO_CHAR(purinv.Inv_Date,'mm') MONTH ,TO_CHAR(purinv.Inv_Date,'YYYY') ,purch.Prod_Code order by TO_CHAR(purinv.Inv_Date,'mm') MONTH ,TO_CHAR(purinv.Inv_Date,'YYYY')
Thank you for helping. Received on Thu Jan 03 2008 - 14:43:21 CST