我正在尝试用sqlite对VarChar字段进行排序.
该字段可以包含数字或数字字母,但我需要按数字顺序排序,如下所示:
1 1a 1b 5 5x 5y 10 10d 10e 10g1 11 11a 11b 100c 100f
有任何想法吗?我已经能够做到这一点……它很接近(但并不完全)我需要的东西:
Pad the start of the field with ‘00000’,and then sort on the 1st five letters
解决方法
简单
select col from tbl order by col*1,col