Please could someone help me?!?
I have the following table:
And I need it to look like this:
Could someone please help me with a Pivot Query that'll produce this?
Answer by Dnirmania ·
Can you provide table info and your requirement in better format. It's really hard to understand.
Additionally, you can use following articles to write your Pivot Query.
Answer by greff379 ·
Oracle PIVOT operator allows you to cross-request a table to those who started using Oracle 11g. This means that you can combine your results and rotate rows into columns.
SELECT * FROM
SELECT column1_id, column2_id
IN ( expr1_id, expr2_id, ... expr_n_id) | subquery
ORDER BY expression_id [ ASC | DESC ];
Oracle 12c, Oracle 11g
We’ll base our example on a table called orders with the following definition:
CREATE TABLE ords
( order_id integer NOT NULL,
custom_ref varchar2(50) NOT NULL,
CONSTRAINT orders_pk_id PRIMARY KEY (order_id)
In order to show you the data for this example, we will select records from the order table with the following SELECT query:
SELECT order_id, custom_ref, prod_id
ORDER BY ord_id;
Answer by Jon Crawford ·
That's hideously hard to read, sample data would help if you could give a temp table creation statement with inserts. But essentially I think you don't need to PIVOT, you just need to concatenate the data? In that case, SELECT column1+column2+column3 (in whatever order) FROM yourTable