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 |
|
matrixtrio
Starting Member
3 Posts |
Posted - 2004-02-13 : 03:27:44
|
| hi,i have a table in database which has a structure like cols ---> A B C D WK QTYrows 1 a1 b1 c1 d1 wk1 10 2 a2 b2 c2 d2 wk2 10 ... now i want the data to appear as like this cols ---> A B C D WK1 rows 1 a1 b1 c1 d1 10 after i execute a 'select' statement on the table where my condition is col D = d1.the output should give wk1 (which is the corresponding data for the above where condition) as the col. heading and the respective qty should go as the data for this 'new column' (which is to come dynamically, as is not present in the database. can anybody think of a solution for this problem. |
|
|
ditch
Master Smack Fu Yak Hacker
1466 Posts |
|
|
matrixtrio
Starting Member
3 Posts |
Posted - 2004-02-13 : 04:25:37
|
quote: Originally posted by ditch There are many articles on Cross tabs at this forum,This one is just one of themhttp://www.sqlteam.com/item.asp?ItemID=2955You should search for more here too.
yeah but what if the column wk increases dynamically??I mean more records are added to the table with new wk values??? |
 |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2004-02-13 : 07:56:53
|
| The dynamic cross tab procedure can handle quite a few pivoted columns. You should be able to handle about 50 pivoted week columns with the original version, and if you read the comments section of the article you'll find a few solutions that increase that number. |
 |
|
|
|
|
|