Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cannot get the average to work in sql statement
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00679197
Message ID:
00679228
Views:
19
I had the parenthesis in wrong place, Sergey helped me out, but here is the statement I was getting at:


.text2.value has date of 07/16/02
.text1.value has date of 01/01/02
vehicle.v_mileage = 50
min(a_startmile = 20
totalmile = 30

I am trying to find average miles per month
WITH thisform
months = (.text2.value-.text1.value)/30
SELECT a_id, a_sup, a_vin, MIN(a_startmile) as begin, vehicle.v_mileage as end, ;
	vehicle.v_mileage-MIN(a_startmile) as totalmile, INT((vehicle.v_mileage-MIN(a_startmile))/months) as average, ;
	a_unit as unit FROM veh_assign_tbl ;
	LEFT JOIN vehicle ON v_id = a_id ;
	GROUP BY a_sup, a_vin WHERE BETWEEN(a_startdate, .text1.value, .text2.value) INTO CURSOR test
	brows

endwith
I also noticed that when I type in
as average
the word average didn't highlight as reserved word, but I'll take you advice and change that.

Thanks
Nick Patel
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform