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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2004-06-08 : 07:55:32
|
Liu writes " I have a table named t1 which includes the following columns: articleID int, ownerID int,quantity int, weight numeric(12,2).The ownerID has 5 status: state,collective,private,shared and other, their ID are 1,2,3,4 and 5. Now, I want a result like this:articleID index state collective private shared other subtotal 1 quantity 100 5 5 5 1 116 1 weight 1 2 2 2 2 9 2 quantity 1 1 1 1 1 5 2 weight 1 1 1 1 1 5summary quantity 101 6 6 6 2 121summary weight 2 3 3 3 3 14 Because I have many queries like this, can you give me a general method ?Thanks a lot!" |
|
|
graz
Chief SQLTeam Crack Dealer
4149 Posts |
Posted - 2004-06-08 : 07:55:32
|
| Have you read our article on cross tab queries? |
 |
|
|
|
|
|