Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Select data like Pivot table
Message
 
 
À
06/07/2006 23:05:41
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01134342
Message ID:
01134343
Vues:
21
Try
SELECT transitNo, ;
		MAX( IIF(region = "NY", "Yes", "No ")) AS NY, ;
		MAX( IIF(region = "CA", "Yes", "No ")) AS CA, ;
		MAX( IIF(region = "FL", "Yes", "No ")) AS FL, ;
		MAX( IIF(region = "CO", "Yes", "No ")) AS CO  ;
	FROM mytable ;
	GROUP BY 1
>
>I have mytable.dbf that contains 2 fields :
>
>transitNo region
>
>00001 NY
>00001 CA
>00001 FL
>00001 CO
>
>00002 CA
>00002 NY
>00002 FL
>00002 CO
>
>How to use SQL statments to have newtable ? with 5 fields like Pivot table
>in Access or Excel to become :
>
>Newtable :
>
>transitNo NY CA FL CO
>00001 yes yes yes yes
>
>00002 yes yes yes yes
>
>Tia for any help in coding with SQL .
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform