Home » SQL & PL/SQL » SQL & PL/SQL » How to merge 2 rows from a table to 1 row (2 columns)
How to merge 2 rows from a table to 1 row (2 columns) [message #672244] |
Mon, 08 October 2018 04:54  |
 |
dsslim
Messages: 4 Registered: March 2018
|
Junior Member |
|
|
Hi,
I have a table below with 6 rows. And I like the end result to be like this:
ID TYPE PRIORITY
001 Tennis P3-P1
002 Gym P2-P3
003 Soccer P1-P2
May I know how do I achieve this ? TIA !
Source DDL:
CREATE TABLE TAB1
( "ID" VARCHAR2(4 BYTE),
"TYPE" VARCHAR2(7 BYTE),
"PRIORITY" VARCHAR2(10 BYTE)
) ;
Insert into TAB1 (ID,TYPE,PRIORITY) values ('0001',null,'P3-P1');
Insert into TAB1 (ID,TYPE,PRIORITY) values ('0001','Tennis',null);
Insert into TAB1 (ID,TYPE,PRIORITY) values ('0002',null,'P2-P3');
Insert into TAB1 (ID,TYPE,PRIORITY) values ('0002','Gym',null);
Insert into TAB1 (ID,TYPE,PRIORITY) values ('0003','Soccer',null);
Insert into TAB1 (ID,TYPE,PRIORITY) values ('0003',null,'P1-P2');
|
|
|
|
|
Goto Forum:
Current Time: Sun May 28 17:19:37 CDT 2023
|