mysql报错:BIGINT UNSIGNED value is out of range

造成原因:

当两个字段想减时,如果其中一个或两个字段的类型的unsigned无签名类型,如果想减的值小于0则会报错(BIGINT UNSIGNED value is out of range)

处理办法:

例:select a - b from table

改:select if(a >= b, a - b, - (b - a)) from table

posted @ 2018-11-22 18:16  李星保  阅读(2505)  评论(0编辑  收藏  举报