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

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

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

(2) 使用函数实现

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

或者

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

 

posted @ 2017-05-11 17:19  记忆沙漏  阅读(4888)  评论(0编辑  收藏  举报