0

I need to do this table transformation, but its little hard for me.

I have original table wich looks like this

enter image description here

and i need to transform the table into this

enter image description here

How can i do that ?

Here i prepared example database http://sqlfiddle.com/#!3/0f324

Thank you for helping.

1
select * from 
(
select SubBrand,Month,Saless,Variable
 from 
(select * from DataTable
)as p
unpivot (Saless for Month in(January,February)) as u
) as p
pivot
(
min(Saless) for  Variable in ([Sales],[Promotion])
)as PP
order by SubBrand,Month
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.