mysql查询类型转换
mysql查询时,转换字段类型:
mysql当使用一个字段(存为数值)排序的时候,这个字段必须是int型,如果不是int型需要转换
SELECT CONVERT(meta_value , SIGNED) as cc FROM wp_postmeta WHERE meta_key = 'post_views_count' order by cc
SELECT CAST(meta_value as SIGNED) as cc FROM wp_postmeta WHERE meta_key = 'post_views_count' order by cc