Mysql Query error: BIGINT UNSIGNED value is out of range in..解決方法

當字段類型爲 unsigned 時,使用相關結果爲負值時就會報錯,報錯如下:

BIGINT UNSIGNED value is out of range in ..


解決方法


使用 cast() 修改字段類型爲 signed

select cast(quantity as signed) - cast(frozen_quantity as signed) from ...


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章