General information
Forum:
Microsoft SQL Server
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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only