Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Best way to code a query
Message
De
16/10/2003 09:11:51
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Best way to code a query
Divers
Thread ID:
00839217
Message ID:
00839217
Vues:
58
OK, here's the question...

I have two tables, one a master and the other a detail.

The master looks like this...

ID Name
1 Kevin
2 Steve

The history table [ a very large history file] looks like this..

ID Status
1 A
1 C
1 D
1 F
1 G
2 B
2 C

I want to create a flat file that will look like this, where I need a flag to indicate whether the user has had even one instance of a status...

ID Name A_Flag B_Flag C_Flag D_Flag etc.
1 Kevin .T. .F. .F. .T.
2 Steve .F. .T. .F. .F.

I wrote a query to do this, but it involves several subqueries and outer joins and some IIF() instances to look for each status. It works, but I'm curious how others would approach this. Performance of the query is important.

Thanks!
Kevin
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform