Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Select data like Pivot table
Message
 
 
To
06/07/2006 23:05:41
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01134342
Message ID:
01134343
Views:
20
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--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform