Click here to Skip to main content
15,893,790 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hello friends
i have a problem in mysql this is my Query and i want the result 1
SQL
SELECT ROUND(0.50,0)

how can i achive this, iam getting 0
Posted

1 solution

Hi,
I believe that the query will always return zero and that is correct based on rule of mathematics. When the decimal part is exactly .5 it returns the whole number as even. That is, 0.50 returns 0 and 1.50 returns 2. In your case, in order for your result to be 1, then the number must be >= 0.51. I hope that helps.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900