![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have a table DEFINITION with this content: def_id game_id generaldef_id definition ======================================== 1 1 1 firstname 2 1 2 lastname 3 1 3 age 4 1 4 status 5 1 5 position 6 2 6 firstname 7 2 7 lastname 8 2 8 nickname etc... Note: There are many possible values to the "definition" row. So the solutions needs to be DYNAMIC! Note 2: Don't worry too much about different game_id's, they are for different kind of games... ... So I need some kind of crosstabbing, or pivoting or rotating.... Any help appreciated. I'm on SQL Server 2005. |
#3
| |||
| |||
|
#4
| |||
| |||
|
|
Consider avoiding t-SQL for such tasks primarily because it is the wrong tool for the job. SQL has little to do with data represented or retrieved in a varying set of columns. A better way would be to get the resultset to the client side, use procedure programming language to loop through the rows and create the display format you need. |
#5
| |||
| |||
|
|
Anith Sen wrote: Consider avoiding t-SQL for such tasks primarily because it is the wrong tool for the job. SQL has little to do with data represented or retrieved in a varying set of columns. A better way would be to get the resultset to the client side, use procedure programming language to loop through the rows and create the display format you need. Unless of course you just happen to live in a country with laws that regulate such matters as audit trails on financial data. Take it out of the database, into Excel no doubt, and you have destroyed any nuance of accountability. The proper place for data is in the database. The proper place for cross-tabulation is in a reporting tool. -- Daniel A. Morgan University of Washington damor...@x.washington.edu (replace x with u to respond) |
![]() |
| Thread Tools | |
| Display Modes | |
| |