0

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.*, 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
helpME
  • 53
  • 1
  • 3

1 Answers1

0

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

Community
  • 1
  • 1
thomasrutter
  • 114,488
  • 30
  • 148
  • 167