Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

SQL for Matrix

user3308033Jun 26 2012 — edited Jun 26 2012
Hi Gurus,

The contents of one of my table : GRP_MAP is as follows :
GRP	COLOUR		TARGET		COUNT	AMOUNT
ABR	BLUE		0.00		6	300000
ABR	RED		0.00		80	3467500
ABR	GREEN		0.00		10	850000
ABR	VIOLET		0.00		73	1927000
ABR			88000000	0	0
APS	BLUE		0.00		4	240000
APS	RED		0.00		15	467000
APS	BLACK		0.00		8	8250000
APS	GREEN		0.00		44	1661000
APS	VIOLET		0.00		281	6170000
APS			14240000	0	0
 
Using the sample data above, i need to generate the following output :
 output

NO.	GRP	TARGET		BLUE	BLUE	RED	RED	BLACK	BLACK	GREEN	GREEN	VIOLET	VIOLET	TOT	TOT
				NO	AMT	NO	AMT	NO	AMT	NO	AMT	NO	AMT	NO 	AMT
1.	ABR	88000000	6	300000	80	3467500	0	0	10	850000	73	1927000	169	14194500
2.	APS	14240000	4	240000	15	467000	8	8250000	44	1661000	281	6170000	352	16788000


	TOT	102240000	10	540000	95	3934500	8	8250000	54     10161000	354	8097000	521	30982500
Can a single SQL work of the above Matrix ?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 24 2012
Added on Jun 26 2012
2 comments
106 views