Click here to Skip to main content
Rate this: bad
good
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 1: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
0 Sergey Alexandrovich Kryukov 398
1 DamithSL 235
2 OriginalGriff 230
3 Zoltán Zörgő 149
4 Dave Kreskowiak 120
0 OriginalGriff 7,575
1 DamithSL 5,529
2 Sergey Alexandrovich Kryukov 5,279
3 Maciej Los 4,961
4 Kornfeld Eliyahu Peter 4,539


Advertise | Privacy | Mobile
Web02 | 2.8.141223.1 | Last Updated 5 Mar 2012
Copyright © CodeProject, 1999-2014
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