I want to display data for user in horizontal form based on a column value. Here is the table structure and insert statements. Also, I have included actual and expected output.
If the pricemethod is 'Guess', I want that value next to price (price_real, price_guess), this will based on code, sellernumber and selldate.
create table TEMP_HORI
(
CODE VARCHAR2(30),
PRICE NUMBER(20,10),
SELLDATE DATE,
SELLERNUMBER NUMBER(10),
PRICEMETHOD VARCHAR2(15)
);
insert into temp_hori (CODE, PRICE, SELLDATE, SELLERNUMBER, PRICEMETHOD)
values ('ABCD', 100.0000000000, to_date('01-10-2014', 'dd-mm-yyyy'), 100, 'Real');
insert into temp_hori (CODE, PRICE, SELLDATE, SELLERNUMBER, PRICEMETHOD)
values ('ABCD', 90.0000000000, to_date('01-10-2014', 'dd-mm-yyyy'), 100, 'Guess');
insert into temp_hori (CODE, PRICE, SELLDATE, SELLERNUMBER, PRICEMETHOD)
values ('ABCD', 101.0000000000, to_date('01-10-2014', 'dd-mm-yyyy'), 299, 'Real');
insert into temp_hori (CODE, PRICE, SELLDATE, SELLERNUMBER, PRICEMETHOD)
values ('ABCD', 109.0000000000, to_date('01-10-2014', 'dd-mm-yyyy'), 500, 'Real');
Actual:
| CODE | PRICE | SELLDATE | SELLERNUMBER | PRICEMETHOD |
| ABCD | 100.0000000000 | 10/1/2014 | 100 | Real |
| ABCD | 90.0000000000 | 10/1/2014 | 100 | Guess |
| ABCD | 101.0000000000 | 10/1/2014 | 299 | Real |
| ABCD | 109.0000000000 | 10/1/2014 | 500 | Real |
Expected:
| CODE | PRICE_REAL | PRICE_GUESS | SELLDATE | SELLERNUMBER |
| ABCD | 100.0000000000 | 90.0000000000 | 10/1/2014 | 100 |
| ABCD | 101.0000000000 | | 10/1/2014 | 299 |
| ABCD | 109.0000000000 | | 10/1/2014 | 500 |