Here is my intial table t1 and final table t2
based on the parameter passed i need to pivot the table
t1
RECORDER_ID | CHANNEL_NO | M | DATE | value |
A | 1 | KW | 11/13/2012 0:00 | 1072.8 |
A | 2 | KVAR | 11/13/2012 0:00 | 447.12 |
A | 1 | KW | 11/13/2012 0:45 | 1066.32 |
A | 2 | KVAR | 11/13/2012 0:45 | 403.2 |
A | 1 | KW | 11/13/2012 1:00 | 1084.32 |
A | 2 | KVAR | 11/13/2012 1:00 | 419.04 |
b | 1 | KW | 11/13/2012 0:00 | 1167.84 |
b | 2 | KVAR | 11/13/2012 0:00 | 444.24 |
b | 3 | KW | 11/13/2012 0:00 | 1159.92 |
b | 4 | KVAR | 11/13/2012 0:00 | 436.32 |
t2
recorder_id | DATE | CHANNEL_1(kw) | CHANNEL_2(KVAR) | ||
a | 11/13/2012 0:00 | 1072.8 | 447.12 | ||
11/13/2012 0:00 | 1066.32 | 403.2 | |||
11/13/2012 0:45 | 1084.32 | 1084.32 | |||
if b is passed | DATE | CHANNEL_1(kw) | CHANNEL_2(KVAR) | channel_3(kw) | ch_4(kvar) |
11/13/2012 0:00 | 1167 | 444 | 1159 | 436 | |
CHANNEL NO MUST BE DISPLAYED BASED ON RECORDERS ID AND | |||||
THEN PIVOTED BASED ON THE SELECTION MADE BY CUSTOMER | |||||