Need assistance on request.

Hello
You can help me please on request.
I have a table as below.


Don't value any Prop n ° of SL series

1 bl 12 134
2 yw 12 234
3 12 er 435
4 12 rt 505
5 12 235 fd
6 12 fg 236
7 12 gh 124
8 12 NL 145
9 13 bl 234
10 13 yw 234
11 13 26 St
12 13 rt 212
13 13 fd 300
fg 14 13, 500
15 13 gh 289
16 13 bn 302


I want to put it as

series yw bl rt bn gh fg fd number
12 134 234 435 505 235 236 124 145
13 234 234 26 212 300 500 289 302


Kindly help me on this one.

Kind regards
Balu.

Published by: user575682 on February 23, 2010 12:22

user575682 wrote:
Hello
You can help me please on request.
I have a table as below.

Sl No     Serial No     Prop     Value

1     12     bl     134
2     12     yw     234
3     12     er     435
4     12     rt     505
5     12     fd     235
6     12     fg     236
7     12     gh     124
8     12     bn     145
9     13     bl     234
10     13     yw     234
11     13     er     26
12     13     rt     212
13     13     fd     300
14     13     fg     500
15     13     gh     289
16     13     bn     302

I want to put it as

serial number     bl     yw   er   rt   fd   fg   gh   bn
12                    134  234 435 505 235 236 124 145
13

You can do it. Here is just one example of data "t".

with t
as
(
select 1 sl_no,12 serial_no,'bl' prop,134 value from dual union all
select 2,12,'yw',234 from dual union all
select 3,12,'er',435 from dual union all
select 4,12,'rt',505 from dual union all
select 5,12,'fd',235 from dual union all
select 6,12,'fg',236 from dual union all
select 7,12,'gh',124 from dual union all
select 8,12,'bn',145 from dual union all
select 9,13,'bl',234 from dual union all
select 10,13,'yw',234 from dual union all
select 11,13,'er',26 from dual union all
select 12,13,'rt',212 from dual union all
select 13,13,'fd',300 from dual union all
select 14,13,'fg',500 from dual union all
select 15,13,'gh',289 from dual union all
select 16,13,'bn',302 from dual
)
select serial_no,
       max(decode(prop,'bl',value)) bl,
       max(decode(prop,'yw',value)) yw,
       max(decode(prop,'er',value)) er,
       max(decode(prop,'rt',value)) rt,
       max(decode(prop,'fd',value)) fd,
       max(decode(prop,'fg',value)) fg,
       max(decode(prop,'gh',value)) gh,
       max(decode(prop,'bn',value)) bn
  from t
 group by serial_no
 order by serial_no

Tags: Database

Similar Questions

Maybe you are looking for