Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Cross-Tab
Message
De
23/07/2003 13:27:01
David Brunelle
Université de Sherbrooke
Sherbrooke, Québec, Canada
 
 
À
Tous
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
Cross-Tab
Divers
Thread ID:
00812848
Message ID:
00812848
Vues:
40
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.. :)
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform