ERROR 1690 (22003): DECIMAL UNSIGNED value is out of range in '(ceshi
.goods
.market_price
- ceshi
.goods
.shop_price
)
方法一:
mysql> select goods_id,goods_name,cast(market_price as signed) - cast(shop_price as signed) from goods;
方法二:
mysql> set sql_mode=‘NO_UNSIGNED_SUBTRACTION’;
mysql> select goods_id,goods_name,market_price - shop_price from goods;
相比第一种方法,第二种方法更方便解决unsigned减法的报错