Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How To Do This With A JOIN?
Message
De
29/12/2005 14:24:38
Mike Yearwood
Toronto, Ontario, Canada
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01081733
Message ID:
01081767
Vues:
14
Hi Kevin

In VFP 9 this works, but not in VFP8

UPDATE LineTemp ;
SET NumCleared = (select count(*) from Details where BoIDBase = LineTemp.BoIDBase and RecType = "A" and AirTime#" " and AirDate BETWEEN dStartDate and dEndDate)

>I have a header table, LineTemp, with is related into Details.
>
>For each LineTemp record, I want to do the code inside the DO WHILE loop
>for all of the Detail records.
>
>I want to do all of this more efficiently. I'm guessing there's a way to do
>this with a JOIN, but I'm not sure of the syntax.
>
>
>
>SELECT LineTemp
>SET RELATION TO BoIdBase INTO Details
>		
>** Loop once for each line item record
>SCAN
>
> ** Clear the number cleared counter
>  m.NumCleared = 0
>
>  ** Loop once for each detail record belonging to the
>  ** current line item
>  SELECT Details
>  DO WHILE BoIdBase = LineTemp.BoIdBase
>
>    ** If the record is active, and has an air time and falls in the
>    ** date range, then count it
>    IF Details.RecType = "A" AND;
>       NOT EMPTY(AirTime) AND ;
>       BETWEEN(AirDate, dStartDate ,dEndDate)
>			
>         ** Increment the number cleared variable		
>         m.NumCleared = m.NumCleared + 1
>
>    ENDIF
>
>    IF EOF()
>      EXIT
>    ELSE
>     SKIP 1
>    ENDIF
>
>  ENDDO
>
>  SELECT LineTemp
>  GATHER MEMVAR
>
>ENDSCAN
>
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform