Does the AVG() method supports some parameter to return decimal values as well?

53 views
Skip to first unread message

acsandeep

unread,
Jun 3, 2015, 11:13:29 AM6/3/15
to orient-...@googlegroups.com
Hi i am using OrientDB version 2.0.8 and as far as i can see the AVG() method only returns the integer part of the result and discards the decimal part.

Would be helpful if it supports an optional param:

Select AVG(rating, true) from Ratings will return the decimal part as well.


Regards
Sandeep

Message has been deleted

alessand...@gmail.com

unread,
Jun 3, 2015, 11:59:50 AM6/3/15
to orient-...@googlegroups.com
Hi,
if your rating is an integer variable, the method avg() will return an integer value. So either you change the type of the variable, or use this query
select AVG(rating.asFloat()) from Ratings

Alessandro



acsandeep

unread,
Jun 4, 2015, 10:51:27 AM6/4/15
to orient-...@googlegroups.com
Thanks Alessandro, it works as you suggested. I was trying to do .asFloat() after it has been computed (duh)
Reply all
Reply to author
Forward
0 new messages