MySQL中 BIGINT UNSIGNED value is out of range

In MYSQL, when two fields are subtracted, if one or two of the fields are of unsigned type,

If the value you want to subtract is less than 0, an error (BIGINT UNSIGNED value is out of range) will be reported
.

例:select a - b from table

解决方案:select if(a >= b, a - b, - (b - a)) from tbl

 

Guess you like

Origin blog.csdn.net/QJQJLOVE/article/details/108673576
Recommended