字段排序的问题?
ab字段为字符型
10 plat
100Plat
20 plat
30 plat
50 plat
怎么才能让他这样排序
10 plat
20 plat
30 plat
50 plat
100plat
------解决方案--------------------顶
------解决方案--------------------关注!
------解决方案--------------------把前面的数字转换成int,再排序
------解决方案--------------------string[] oldStr = new string[] { "10 plat ", "100Plat ", "20 Plat " };
int[] temp = new int[oldStr.Length];
for (int i = 0; i < oldStr.Length; i++)
{
temp[i] =Convert.ToInt32( oldStr[i].Substring(0, 3).Trim());
}
------解决方案--------------------SELECT CONVERT(int, REPLACE(aaaa, 'plat ', ' ')) AS bbb
FROM test
ORDER BY bbb DESC