Jack
Jack

Reputation: 11

Return AVG as FLOAT in MS-Access

I am trying to return the Average as a FLOAT, but when I use the code bellow, I get an error every time in Access saying MissingOperator. What am I missing in my code?

SELECT AVG(CAST(Quantity AS FLOAT))
FROM Orders

Upvotes: 0

Views: 323

Answers (2)

Gordon Linoff
Gordon Linoff

Reputation: 1270421

I often just write:

SELECT AVG(1.0 * Quantity)
FROM Orders;

However, this might return the value as a decimal rather than a float.

Upvotes: 0

Jack
Jack

Reputation: 11

SELECT AVG(CDBL(Quantity))
FROM OrderDetails;

Upvotes: 1

Related Questions