Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Is there a more elegant solution SQL
Message
 
À
27/07/2007 11:44:08
Bill Drew
Independent Consultant
Chicago, Illinois, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01244138
Message ID:
01244145
Vues:
30
>I'm looking to count the number of incidents various ranges of months.
>
>Can the following query be done without the second procedural step -- purely in SQL?
>
>
>*******************************
>PROCEDURE GetViosInRange
>*******************************
>LPARAMETERS tcVioCat,tnLowMonths,tnHiMonths,tnLowBound,tnHiBound
>LOCAL lnRetVal
>SELECT * FROM WCDRVA ;
>WHERE mvrcat = tcVioCat ;
>AND BETWEEN(monthsago,tnLowMonths,tnHiMonths) ;
>AND drvseq = this.drivernum;
>INTO cursor thesevios
>lnRetVal = 0
>IF tnlowbound > 0
>   SKIP tnlowbound-1
>   SCAN WHILE RECNO() <= tnhibound
>     lnretval = lnretval + 1
>   ENDSCAN
>endi
>RETURN lnRetVal
>
Can you post some example data and what you want as a result from it?
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform