Hi
I have a table with 3 columns of data and would like to pivot it as the result shown below, please help me with the pivot or other syntax.
CREATE TABLE pivot_test (
id NUMBER,
customer_id NUMBER,
COURSE VARCHAR2(5),
GRADE VARCHAR(25)
);
INSERT INTO pivot_test VALUES (1, 1, 'A', 'GOOD');
INSERT INTO pivot_test VALUES (2, 1, 'B', 'GOOD');
INSERT INTO pivot_test VALUES (3, 1, 'C', 'GOOD');
INSERT INTO pivot_test VALUES (4, 2, 'A', 'BAD');
INSERT INTO pivot_test VALUES (5, 2, 'C', 'POOR');
INSERT INTO pivot_test VALUES (6, 3, 'A', 'GOOD');
INSERT INTO pivot_test VALUES (7, 3, 'B', 'POOR');
INSERT INTO pivot_test VALUES (8, 3, 'C', 'GOOD');
INSERT INTO pivot_test VALUES (9, 4, 'A', 'POOR');
select * from pivot_test;
A B C
CUSTOMERID Good Bad Poor Good Bad Poor Good Bad Poor
1 1 1 1
2 1 1
3 1 1 1
4 1
I've added Oracle area to attract the correct Experts.