下面是官方资料:
[28 Jun 2011 15:54] Jun Yao Description:(5 DIV 2) and (5.0 DIV 2) results in different values. This is not the same behavior in MySQL 5.0 version, in which results seem to make more sense.How to repeat:SELECT 5 DIV 2;Result = 2SELECT 5.0 DIV 2;Result = 3Suggested fix:Since the documentation states that DIV is similar to FLOOR, after the decimal division, maybe FLOOR should be used instead of rounding to the nearest integer.
[28 Jun 2011 16:00] Jun Yao
In 5.1, results are also consistent. Both (5.0 div 2) and (5 div 2) equal 2.
[29 Jun 2011 7:13] Valeriy Kravchuk
Thank you for the bug report. Verified just as described. Looks like regression comparing to 5.1.x.
[24 Sep 2011 16:48] Paul DuBois
Noted in 5.5.16, 5.6.3 changelogs.(5 DIV 2) and (5.0 DIV 2) produced different results (2 versus 3)because the result of the latter expression was not truncated beforeconversion to integer. This differed from the behavior in MySQL 5.0and 5.1. Now both expressions produce 2.