Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
JasonAnt
Starting Member
23 Posts |
Posted - 2007-09-26 : 12:58:11
|
I have tbWarehouseStock, containWHCode Item Stock------ ------ -----WH001 Pencil 10WH001 Pen 10WH002 Pencil 5WH003 ruler 100How to make pivot query like this, I am thinking of dynamic SQL but dont know how to do thisItem WH001 WH002 WH003 WH004 WH005 ....------ ----- ----- ----- ----- -----Pencil 10 5 0Pen 10 0 0Ruler 0 0 100thanks |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-09-26 : 12:59:36
|
How many distinct WHCodes are there? E 12°55'05.25"N 56°04'39.16" |
|
|
JasonAnt
Starting Member
23 Posts |
Posted - 2007-09-26 : 13:00:58
|
assume max 100 warehouses |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-09-26 : 13:05:31
|
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=55210&SearchTerms=crosstab,pivot E 12°55'05.25"N 56°04'39.16" |
|
|
|
|
|