Click here to Skip to main content
12,507,058 members (65,046 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: MySQL
Hello friends
i have a problem in mysql this is my Query and i want the result 1
SELECT ROUND(0.50,0)
how can i achive this, iam getting 0
Posted 21-Feb-12 0:02am

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160927.1 | Last Updated 5 Mar 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100