Let's say we have some data;
id 1 2 3
price 5 5 7
old_price 5 5 8
I want it like this;
id 1 3
price 5 7
old_price 5 8
How its work in oracle?
CodePudding user response:
I think you could do something like this:
select min(id) as id, price, old_price from your_table_name group by price, old_price
CodePudding user response:
Just select the named columns:
SELECT column1, column2, column4
FROM your_table
Which, for the sample data:
CREATE TABLE your_table (column1, column2, column3, column4) AS
SELECT 'id', 1, 2, 3 FROM DUAL UNION ALL
SELECT 'price', 5, 5, 7 FROM DUAL UNION ALL
SELECT 'old_price', 5, 5, 8 FROM DUAL;
Outputs:
COLUMN1 | COLUMN2 | COLUMN4 |
---|---|---|
id | 1 | 3 |
price | 5 | 7 |
old_price | 5 | 8 |