Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Help with Pivot

Status
Not open for further replies.

cs2009

Programmer
Joined
Aug 10, 2009
Messages
50
Location
US
Using SQL Server 2005.

I have data in a table like this:

Product Cost 1 Cost 2 Bkt

MUOV18I001108 2.47 0.00 1
MUOV18I001108 0.08 0.00 2
MUOV18I001108 0.13 0.00 3
UOIBQVV237BGD 1.39 0.34 1
UOIBQVV237BGD 0.97 1.76 2
UOIBQVV237BGD 1.18 0.25 3

And I want to display it like this:

MUOV18I001108 2.47 0.00 0.08 0.00 0.13 0.00
UOIBQVV237BGD 1.39 0.34 0.97 1.76 1.18 0.25

Can someone help with the query? Maybe a pivot command?

Thanks.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top