Comments on: How to avoid imprecise DECIMAL math in MySQL http://www.xaprb.com/blog/2006/03/08/decimal-math-in-mysql/ Stay curious! Mon, 13 May 2013 05:55:40 +0000 hourly 1 http://wordpress.org/?v=3.5.1 By: Xaprb http://www.xaprb.com/blog/2006/03/08/decimal-math-in-mysql/#comment-15124 Xaprb Tue, 23 Sep 2008 03:28:18 +0000 http://www.xaprb.com/blog/?p=108#comment-15124 1 + 2

(Just testing to see if upgrading WP fixed the issues with plus)

]]>
By: newman http://www.xaprb.com/blog/2006/03/08/decimal-math-in-mysql/#comment-15118 newman Sat, 20 Sep 2008 03:57:47 +0000 http://www.xaprb.com/blog/?p=108#comment-15118 note: topay PLUS dues

looks like the blog dont accept plus ^^.

]]>
By: newman http://www.xaprb.com/blog/2006/03/08/decimal-math-in-mysql/#comment-15117 newman Sat, 20 Sep 2008 03:56:32 +0000 http://www.xaprb.com/blog/?p=108#comment-15117 Thank you very much, i thought i would be the only one on this world wide web with that problem. This is a very strange bug, which took me at least 3 days.

The problem wasn’t the solving, i just couldn’t believe that such a big mistake would be a system bug from mysql. The first time i’ve found it with that statement:

SELECT * FROM table WHERE ( topay dues ) > paid

I got a result, although everything was paid. After checking this with:

SELECT ( ( topay dues ) – paid ) as result FROM table WHERE ( topay dues ) > paid

it gave me : 0.00

which confused me more, well the end of the story, how i found a acceptable solution:

SELECT * FROM table WHERE ( ( topay dues ) – paid ) > 0.0001

]]>
By: Jason http://www.xaprb.com/blog/2006/03/08/decimal-math-in-mysql/#comment-10150 Jason Fri, 01 Jun 2007 06:26:10 +0000 http://www.xaprb.com/blog/?p=108#comment-10150 Thanks for all that info, it was good to find out why the problem is happening rather than just that it cant work…
I seem to have worked out the issue I was having with float types with the following statement – hope it helps anyone else. Cheers:

SELECT ID, Round(Sum(Total),2) As calcTotal FROM table
GROUP BY ID
HAVING Round(Sum(Total),2) > 0
ORDER by calcTotal DESC

]]>