Home » SQL & PL/SQL » SQL & PL/SQL » Pivoting Data
Pivoting Data [message #637150] Mon, 11 May 2015 18:33 Go to next message
vpat
Messages: 1
Registered: May 2015
Location: United States
Junior Member
Hi Friends,

I am new in SQL and I have a below data ( sample data shown below ( also attached in File1.jpg)) and I need data in a single row per ID ( shown below, also attached File2.jpg). Please help and I need this to be done quickly.

Sample Data:

ID, TaskName, Type, Date
44400 M0 A 1/1/2015
44400 M1 A 1/3/2015
44400 M2 A 1/4/2015
44400 M1 CF 2/1/2105
44400 DG1 CF 2/2/2015
44400 M0 POR 2/11/2015
45000 M0 A 2/1/2015
45000 M1 A 2/3/2015
45000 M2 A 2/4/2015
45000 M1 CF 3/1/2105
45000 DG1 CF 3/2/2015
45000 M0 POR 3/11/2015

Expected Result:

ID M0_A M1_A M2_A M1_CF DG1_CF M0_POR
44400 1/1/2015 1/3/2015 1/4/2015 2/1/2015 2/2/2015 2/11/2015
45000 2/1/2015 2/3/2015 2/4/2015 3/1/2015 3/2/2015 3/11/2015

/forum/fa/12670/0/

Thank you for your help in advance.
-vpat
  • Attachment: File3.jpg
    (Size: 96.05KB, Downloaded 1055 times)
Re: Pivoting Data [message #637151 is a reply to message #637150] Mon, 11 May 2015 18:41 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
Welcome to this forum.

Please read and follow the forum guidelines, to enable us to help you:

http://www.orafaq.com/forum/t/88153/0/ and read http://www.orafaq.com/forum/t/174502/

Re: Pivoting Data [message #637162 is a reply to message #637150] Tue, 12 May 2015 00:19 Go to previous message
Michel Cadot
Messages: 68643
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Welcome to the forum.
This is a FAQ, please do search for "pivot".

Also please read OraFAQ Forum Guide and How to use [code] tags and make your code easier to read.
Always post your Oracle version, with 4 decimals.

With any SQL or PL/SQL question, please, Post a working Test case: create table (including all constraints) and insert statements along with the result you want with these data then we will be able work with your table and data. Explain with words and sentences the rules that lead to this result.

Previous Topic: ORA-01847 problem
Next Topic: Oracle case statment solution
Goto Forum:
  


Current Time: Tue Apr 23 13:31:45 CDT 2024