Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cross-Tab
Message
From
23/07/2003 13:27:01
David Brunelle
Université de Sherbrooke
Sherbrooke, Quebec, Canada
 
 
To
All
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Title:
Cross-Tab
Miscellaneous
Thread ID:
00812848
Message ID:
00812848
Views:
39
A friend of mine is trying to make a cross-tab query with VB that is connected to a SQL server. As VB goes, this is not a problem. The real problem comes from the fact that it seem like SQL server (I suppose 2000 but it can be 7 to) doesn't work the same way that access do (which is what they used before)... What is the syntax of a cross-tab query for SQL Server???

As a sake of example, suppose we have this table

ID Item Used value
1 a 1
1 a 2
1 b 1
2 a 2
2 c 1
2 d 2
3 a 1
3 b 2
3 b 5
3 e 2
3 e 1
3 e 3
3 e 3

and A cross-tab query that would return

ID\Item
a b c d e
1 3 1 0 0 0
2 2 0 1 2 0
3 0 7 0 0 9

As we can see, the row is ID and the column is Item Used, the value are the sum of value for each group

I think this example is simple yet complete enough to help me.. :)
Next
Reply
Map
View

Click here to load this message in the networking platform