MySQL按字母顺序-数字
问题描述:
有没有办法像这样在MySQL中对元素进行排序:
Is there any way to sort Elements in MySQL like this:
元素:
- 城市1
- 城市2
- 城市10
- 城市1a
当我执行ORDER BY时,列表看起来是这样的:
When i do the ORDER BY the list looks this way:
- 城市1
- 城市1a
- 城市10
- 城市2
因为所有答案都不符合我的特殊问题,所以我编辑了我的问题. 在数字后面也有带字符的Elements.观看示例
Because all answer did not match to my special problem i edit my question. There are also Elements with Chars behind the numbers. Watch the example
答
尝试一下技巧-'ORDER BY column_name + 1',例如:
Try this trick - 'ORDER BY column_name+1', e.g.:
SELECT * FROM element
ORDER BY column_name+1;