Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: SQL

Re: SQL

From: Martin Haltmayer <Martin.Haltmayer_at_0800-einwahl.de>
Date: 2000/04/13
Message-ID: <38F5145A.18A03FCB@0800-einwahl.de>#1/1

cursor c is
select --+ all_rows

	r.resource_type
	, r.sum_qty
	, s.sum_qty
from
	(
		select 
			resource_type
			, sum (qty) as sum_qty 
		from 
			recordings 
		where 1 = 1
		and task_code = 'L' 
		group by resource_type
	) r,
	(
		select 
			resource_type
			, sum (qty) as sum_qty 
		from 
			recordings 
		where 1 = 1
		and task_code = 'P' 
		group by resource_type
	) s

where 1 = 1
and s.resource_type = r.resource_type
order by resource_type
;

kskasi_at_hotmail.com wrote:
>
> Hi everyone
>
> I have an SQL which looks like the following
>
> Select resource_type, task_code, sum(qty)
> from recordings
> group by resource_type, task_code;
>
> The result set looks like the following
> L 20010 1
> L 30010 2
> L 40010 3
> P 20010 4
> P 30010 5
> P 40010 6
>
> I want the output to be displayed in the following format
> L P
> 20010 1 4
> 30010 2 5
> 40010 3 6
>
> Is it possible to so. I need to do that inside a cursor
>
> regards...kasi
Received on Thu Apr 13 2000 - 00:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US