原有表中的点击次数用的是 字符串型,现要求按点击次数排序,

select  *  from table t order by  t.click desc

查出的是按左对齐排序的

99
97
9
89
783
7

而我要求的是按数字大小排的序

要修改为

select  *  from table t order by  cast   (t.click   as   int) desc

783
99
97
89
9
7

结果正确.

相关文章:

  • 2022-12-23
  • 2021-07-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-19
猜你喜欢
  • 2021-07-13
  • 2021-08-15
  • 2022-12-23
  • 2021-10-18
  • 2021-06-16
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案