1.直接用加法

字符串+0

例:select * from a order by (column+0) desc

2.类型转换函数 CONVERT和CAST

CAST(column as type)

CONVERT(column, type)

例:select * from a order by CONVERT(column,SIGNED) desc

select * from a order by CAST(column as SIGNED) desc

SELECT CONVERT(filedName, UNSIGNED INTEGER)

2.1常用的转换类型

DATE日期类型

DATETIME日期时间类型

TIME时间类型

CHAR 字符类型

SIGNED有符号整型(包含正负数)

UNSIGNED无符号整型(正数)

BINARY二进制格式

2.2二者区别

convert()有两个参数,第一个为转换内容,第二个为转换类型;如:convert('123', UNSIGNED INTEGER)

cast()有一个参数,参数格式:转换内容 AS 转换类型;如:cast('123' AS UNSIGNED INTEGER)