当字段类型为 unsigned 时,使用相关结果为负值时就会报错,报错如下:
BIGINT UNSIGNED value is out of range in ..
解决方法
使用 cast() 修改字段类型为 signed
select cast(quantity as signed) - cast(frozen_quantity as signed) from ...
转载于:https://blog.51cto.com/bstdn/1951064
当字段类型为 unsigned 时,使用相关结果为负值时就会报错,报错如下:
BIGINT UNSIGNED value is out of range in ..
解决方法
使用 cast() 修改字段类型为 signed
select cast(quantity as signed) - cast(frozen_quantity as signed) from ...
转载于:https://blog.51cto.com/bstdn/1951064