Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Select SUM and calculate sum() different values
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Select SUM and calculate sum() different values
Divers
Thread ID:
00382827
Message ID:
00382827
Vues:
73
Has anyone come across these commands that return different results with the same query condition

CODE SECTION
-----------------
rdates(1) = a date defined by the user
rdates(2) = calculated date based on a rule - which is always the lesser of the two dates

* sum the values between these dates
CALCULATE SUM(hrs_driving+hrs_onduty) TO Results(1) ;
FOR logs.employee_code = THISFORM.EMPLOYEE_CODE1.Text1.VALUE ;
AND BETWEEN(logs.txdate,rdates(2),rdates(1))

* sum the values between these dates
SELECT SUM(hrs_driving+hrs_onduty) AS 'results1' ;
FROM logs!logs INTO CURSOR 'test1' ;
WHERE logs.employee_code = THISFORM.EMPLOYEE_CODE1.Text1.VALUE ;
AND BETWEEN(logs.txdate,rdates(2),rdates(1))
-----------------
The results are :
Calculate sum() = 73.5
SQL sum() = 63.00

IF ANY ONE CAN SPOT THE PROBLEM PLEASE LET ME KNOW...

TIA
Shawn
Shawn Dorion
Geo Sektor Dot Com
Website: http://www.geosektor.com

Web Hosting Plans
Visit : http://WebHosting.Applications4u.com/
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform