Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Select SUM and calculate sum() different values
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Select SUM and calculate sum() different values
Miscellaneous
Thread ID:
00382827
Message ID:
00382827
Views:
74
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/
Next
Reply
Map
View

Click here to load this message in the networking platform