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

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -