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:
00679215
Views:
19
>I am trying to get an average from following sql statement but it returns wrong number:
>
>v_mileage = 50
>min(a_startmile) = 30
>v_mileage-(min(a_startmile) is equal to 20
>
>
>
(vehicle.v_mileage-(MIN(a_startmile))/6.5) as average
>
>
>gives me
45.3846
which is wrong.
>
>Is there a trick to get an average in an sql statement?

Hi Nick,

Could you provide more details - i.e.:

1. a couple of table records as a sample of your data,
2. your full SQL statement,
3. what exactly your are trying to achieve.

Also, AVERAGE is a reserved word in VFP ant it is better not to use it as a field name.
Did you consider to use CALCULATE [AVG] function (if applicable)?
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro

"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform