SQL Server Integration Services – Pivot Transformation

pts.
Tags:
Data warehousing applications
Microsoft Windows
SQL Server
I'm trying to transform; fld1 fld2 fld3 fld4 value A B C 2 100 A B C 3 250 A B C 4 400 to; fld1 fld2 fld3 feb mar apr A B C 100 250 400 but I'm getting; fld1 fld2 fld3 feb mar apr A B C 100 NULL NULL A B C NULL 250 NULL A B C NULL NULL 400 What am I doing wrong?

Answer Wiki

Thanks. We'll let you know when a new response is added.

You need to group the results by fld1, fld2, fld3, and also sum the fields feb, mar, apr, i.e.

select fld1, fld2, fld3, sum(…statements to create feb field) as feb, sum(…. ) as mar, sum(…) as apr
group by fld1, fld2, fld3

and optionally:
order by fld1, fld2, fld3

Hope this helps.

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following