开发者

How to order numeric and non-numeric values in MySQL

I was wondering how can I order numeric and non-numeric values using MySQL.

Here is what is outputed.

1
10
1234
2
25
26
a
b
c
d

Here is what I want.

1
2
10
25
26
1234
a
b
c
d

Here is my MySQL code.

SELECT tags开发者_StackOverflow.*, COUNT(tag_id) as number_of_tags 
FROM tags 
INNER JOIN posts_tags ON tags.id = posts_tags.tag_id
GROUP BY tags.tag
ORDER BY tags.tag ASC


Check out Natural Sort in MySQL, I think you want a natural sort, which sadly does not exist in mysql yet.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜