mysql报错BIGINT UNSIGNED value is out of range
执行如下语句报错:
select * from table_name
where a - b > 100;
其中a,b字段类型都为int(10) unsigned
解决方案:
使用cast(a as signed)语法将字段转换为signed. 最终语句如下:
select * from table_name
CAST(a as signed) - CAST(b as signed) > 100
执行如下语句报错:
select * from table_name
where a - b > 100;
其中a,b字段类型都为int(10) unsigned
使用cast(a as signed)语法将字段转换为signed. 最终语句如下:
select * from table_name
CAST(a as signed) - CAST(b as signed) > 100