Jump to content

[SOLVED] help sorting


jdubwelch

Recommended Posts

i have a mysql db with a column called "section".  I want it to sort ascending, but it's not sorting the way i want it too.

This is how it's sorting.

10
11
12
12:1-3
17:15-22
18:16-33
1:1-2
1:3-31
2
20:1-2
21:9-14
22:1-2
22:3-19
24:61

 

Is there  a way I can get it to sort it so it'd be:

1:1-2
1:3-31
2 
11
12
12:1-3
17:15-22
18:16-33
20:1-2
21:9-14
22:1-2
22:3-19
24:61

 

 

 

Link to comment
Share on other sites

okay, so i get it to sort by the first number with with, but i don't know about the ones after the ":"... ideas?

 

SELECT section FROM  `media` ORDER BY (section +0)

1:3-31
1:1-2
2
3:1-24
3:1-24
4
6:1-22
6:1-22
7
8
8:6-12
9
9:18-27
10
11
12
12:1-3
13-14
14:17-24
15
15
16-17
17-18
17:15-22
18:16-33
20:1-2
21:9-14
22:3-19
22:1-2
24:61

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.