本文摘自PHP中文网,作者藏色散人,侵删。
mysql转int的方法:1、通过手动转化类型;2、使用MySQL函数CAST实现转换;3、使用MySQL函数CONVERT实现转换。

推荐:《PHP视频教程》
MySQL varchar转换为int
1. 手动转化类型(直接+0)
示例:
1 | select server_id from cardserver where game_id = 1 order by server_id+0 desclimit 10
|
2. 使用MySQL函数CAST:
示例:
1 | select server_id from cardserver where game_id = 1 order by CAST(server_id as SIGNED) desc limit 10;
|
3. 使用MySQL函数CONVERT:
示例:
1 | select server_id from cardserver where game_id = 1 order by CONVERT(server_id,SIGNED)desc limit 10;
|
附注:
阅读剩余部分
相关阅读 >>
mysql解决时区相关问题
mysql 幻读怎么解决?
mysql特点是什么
在linux系统安装mysql步骤截图详解
mysql大小写敏感的问题
怎样用命令开启mysql?
mysql外键基本功能与用法详解
mysql存储过程是什么样
php连接mysql数据库方法简化版
mysql错误代码1064解决办法是什么?
更多相关阅读请进入《mysql》频道 >>
机械工业出版社
本书主要讲述了数据模型、基于对象的数据库和XML、数据存储和查询、事务管理、体系结构等方面的内容。
转载请注明出处:木庄网络博客 » mysql 如何转 int