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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL: combine multiple rows into single row

Status
Not open for further replies.

dalermatt

IS-IT--Management
Jun 17, 2004
2
US
I have a table where each row shows a part number and the location of that part in one of three warehouses, A,B or C:
Row 1: PartNo = 1 WHS = A Location = 101
Row 2: PartNo = 1 WHS = B Location = 9A
Row 3: PartNo = 1 WHS = C Location = 34
Row 4: PartNo = 2 WHS = A Location = 17
Row 5: PartNo = 2 WHS = C Location = 33
Row 6: PartNo = 3 WHS = B Location = 17C
Row 7: PartNo = 3 WHS = C Location = 33

What I'd like to do is reformat this so that the data for each part shows up in a single row:
Part WHS A WHS B WHS C
1 101 9A 34
2 17 33
3 17C 33

How can I accomplish this with T_SQL?

Thanks in advance...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top