Re: a cross tab??
From: Totti <saliba.toufic.george_at_gmail.com>
Date: Thu, 3 Jan 2008 07:35:41 -0800 (PST)
Message-ID: <074b9529-e768-4bda-99b3-0ab20d4669d5@i12g2000prf.googlegroups.com>
Date: Thu, 3 Jan 2008 07:35:41 -0800 (PST)
Message-ID: <074b9529-e768-4bda-99b3-0ab20d4669d5@i12g2000prf.googlegroups.com>
well, to do this, i am trying to use two functions, but as i
understood from the site Mr. Morgan sent me (thank him very much), the
crosstabulation must be done from one table; this is not the case with
me.the first two columns are generated so :
SELECT TO_CHAR(Pmt_date,'mm') MONTH ,TO_CHAR(Pmt_date,'YYYY') YEAR
from purpmt
group by TO_CHAR(Pmt_date,'mm'),TO_CHAR(Pmt_date,'YYYY')
order by TO_CHAR(Pmt_date,'YYYY')
and the rest like so:
select decode(to_char(Prod_Code),'SP-20.2', qty) as frstProd, decode(to_char(Prod_Code),'SP-20.1', qty ) as scndProd, decode(to_char(Prod_Code),'SP-20.6', qty ) as thirdProdfrom purch
now how can i relate those two functions? to get the result in the upper message and also i want to fill the gaps generated by the second func. by '0', but i am not sure how to use the NVL to do so.
Thanks you all Received on Thu Jan 03 2008 - 09:35:41 CST