當字段類型爲 unsigned 時,使用相關結果爲負值時就會報錯,報錯如下:
BIGINT UNSIGNED value is out of range in ..
解決方法
使用 cast() 修改字段類型爲 signed
select cast(quantity as signed) - cast(frozen_quantity as signed) from ...
當字段類型爲 unsigned 時,使用相關結果爲負值時就會報錯,報錯如下:
BIGINT UNSIGNED value is out of range in ..
解決方法
使用 cast() 修改字段類型爲 signed
select cast(quantity as signed) - cast(frozen_quantity as signed) from ...