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
https://forums.phpfreaks.com/topic/73982-solved-help-sorting/
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
https://forums.phpfreaks.com/topic/73982-solved-help-sorting/#findComment-373481
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.