Home » SQL & PL/SQL » SQL & PL/SQL » need to create colums from distinct rows in reporting (oracle 10g r2)
need to create colums from distinct rows in reporting [message #444599] Mon, 22 February 2010 23:10 Go to next message
abhi_shakya
Messages: 50
Registered: September 2009
Location: Nepal
Member
i hace a table PRODUCT with following structure:

Productcode Productname Quantity
AF Ade Fgh 100
LO Ldo Ope 50
SK Ske Kro 47
....

There may be any number of records in tha table.
Now I need to print distinct products in different colums such as.
AF LO SK
100 50 47


There may be any number of products...I need to print all those products as different columns as shown above.
How to write the Stored procedure for this?? please help me out.
hoping for your co-operation
Re: need to create colums from distinct rows in reporting [message #444601 is a reply to message #444599] Mon, 22 February 2010 23:13 Go to previous messageGo to next message
delna.sexy
Messages: 941
Registered: December 2008
Location: Surat, The Diamond City
Senior Member
Search for PIVOT here. You will get many threads having same questions.

regards,
Delna
Re: need to create colums from distinct rows in reporting [message #444611 is a reply to message #444599] Tue, 23 February 2010 00:18 Go to previous message
rahulvb
Messages: 924
Registered: October 2009
Location: Somewhere Near Equator.
Senior Member
ORA FAQ PIVOT and Thanks to Kevin.

[edit :Typo]

[Updated on: Tue, 23 February 2010 00:19]

Report message to a moderator

Previous Topic: Query to store the results - Runs for long time
Next Topic: How to avoid the max funtion
Goto Forum:
  


Current Time: Sun Dec 04 22:46:28 CST 2016

Total time taken to generate the page: 0.10086 seconds