rounding - MySQL Round() function won't round down -


im running mysql version 5.5.3. have code:

select distinct model, round(avg(overallrating),1) car_ratings, car_details car_ratings.carid = car_details.carid , make = 'holden' group model order avg(overallrating) desc, model asc 

this gives me average rating of each model within 'holden' make vehicles. works fine except rounds number 4.050 4.1. there way of making number round down? gives me 4.0 instead of 4.1.

are looking round down in scenarios? if so, you're looking floor

http://dev.mysql.com/doc/refman/5.0/en/mathematical-functions.html#function_floor

select distinct model, floor(avg(overallrating) * 10) / 10 -- here car_ratings, car_details car_ratings.carid = car_details.carid , make = 'holden' group model order avg(overallrating) desc, model asc 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -