mysql varchar类型转换int类型找出最大值

(1) 不严谨的,最简单的

select MAX(字段名 + 0) from 表名;

(2) 使用函数实现

select MAX(cast(字段名 as SIGNED INTEGER)) from 表名;

或者

select MAX(cast(字段名 as UNSIGNED INTEGER)) from 表名;

  

猜你喜欢

转载自www.cnblogs.com/a9999/p/10457008.html