sql语句排序无效的问题
数据可视化时因为数据类型排序无效的问题:这是由于你要排序的类型是String类型的而ORDER BY 方法排序要求整数型。
这就需要在ORDER BY 后加 CAST(需要排序的字段 AS UNSIGNED)如下:
SELECT ip0,sumtraffic FROM data2 ORDER BY CAST(sumtraffic AS UNSIGNED) DESC limit 10
数据可视化时因为数据类型排序无效的问题:这是由于你要排序的类型是String类型的而ORDER BY 方法排序要求整数型。
这就需要在ORDER BY 后加 CAST(需要排序的字段 AS UNSIGNED)如下:
SELECT ip0,sumtraffic FROM data2 ORDER BY CAST(sumtraffic AS UNSIGNED) DESC limit 10