Can anyone tell me why the following is happening, and how to fix it?
I have a MySQL query with an ORDER BY clause that looks like this..
ORDER BY (d
It's a known issue regarding subtraction from unsigned integers.
Subtraction between integer values, where one is of type UNSIGNED, produces an unsigned
result by default. If the result would otherwise have been negative, it becomes the
maximum integer value. If the NO_UNSIGNED_SUBTRACTION
SQL mode is enabled, the result is
negative.
Reference: Numeric Types