MYSQL中当两个字段相减时,如果其中一个或两个字段的类型的unsigned无签名类型,
如果想减的值小于0则会报错(BIGINT UNSIGNED value is out of range)
处理办法:
例:select a - b from table解决方案:select if(a >= b, a - b, - (b - a)) from tbl
MYSQL中当两个字段相减时,如果其中一个或两个字段的类型的unsigned无签名类型,
如果想减的值小于0则会报错(BIGINT UNSIGNED value is out of range)
处理办法:
例:select a - b from table解决方案:select if(a >= b, a - b, - (b - a)) from tbl