一个关于MySQL字符串排序,在数据里面定义的是varchar类型,实际存放的是Int类型的数据,按一下查询语句进行排序: 
将字段*1或者+0可以将MySQL字符串字段按数值排序 


如:

select * from table where 1 order by id*1 desc; 

或者:

select * from table where 1 order by id+0 desc;

除了上述方法外,这里附上一种排序方法,利用find_in_set()进行无敌排序

 

来源:https://blog.csdn.net/weixin_40607363/article/details/81776951

相关文章:

  • 2021-07-13
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-19
  • 2021-08-27
  • 2022-01-08
  • 2021-08-13
猜你喜欢
  • 2021-12-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-15
相关资源
相似解决方案