当前位置: 代码迷 >> 综合 >> MySQL中 BIGINT UNSIGNED value is out of range
  详细解决方案

MySQL中 BIGINT UNSIGNED value is out of range

热度:39   发布时间:2024-02-20 06:51:20.0

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

 

  相关解决方案