mysql - Get to 2 decimal places -
i have line of query here
if (type = 1, (if(isnull(users), '', ((sum(actual) / 1) * 0.04/12) * if(users = "user", booked/(36/12),'') )) , 'false')
the example output 123.3333333
i want output 2 decimals it'll 123.33
should place truncate or round command?
thank you!
you can use truncate()
truncate(123.3333333, 2) = 123.33 if (type = 1, ( if(isnull(users), '', truncate( ( (sum(actual) / 1) * 0.04/12) * if(users_0.user_name = "user", booked/(36/12),'') ),2) ) , 'false')
Comments
Post a Comment