Strange ordering

liunx

Guest
i got problems with ordering numbers

$result = mysql_query("SELECT * FROM monsters ORDER BY hp ASC");


this is what i got in result:


10
10
10
10
100
1000
10000
10130
10200
1026
1026
1056
1056
1056
1056
10580
10738
11492
1176
1176
12000
1282
1282
130
130
1320
13500
1372
14107
1417
14500
15
15
150
1500
1560
15800
1584
1584
160
1620
170
175
175
17500
1765
1796
18000
1806
18300
1900
1901
1901
1901
1901
1932
19540
1992
1992
20
200
2000
2047
2100
21000
2247
2247
2247
2247
2345
2350
2394
2398
24500
2457
255
2617
270
2709
2709
2740
27800
2867
28920
2956
2993
300
300
3000
3042
3042
30670
3165
3198
320
3200
32000
3222
3250
3285
3285
330
340
3528
3612
3620
3632
3632
3632
3632
3632
3632
3632
3632
3632
3632
3720
375
375
4120
413
420
4296
430
4368
4437
4440
4440
4494
450
4500
4500
4512
4690
4837
4870
4870
4927
50
5017
5040
510
5100
518
5200
532
55
561
561
5640
5661
570
572
583
60
60
6200
627
627
63
6330
6354
646
660
674
69
708
720
7264
7281
729
7380
75
75
756
784
784
792
80
8500
885
8872
90
9000
920
924
9266
9291
9413
966
990
996


is doesn't order like normal

all the column types are VARCHAR like usuall....being VARCHAR I think tha tis right. if it was INT then you would see something different.Scoutt is right on the money. Character ordering is different than integer ordering. Change the data type to int and you should see a difference.

Just a note of interest, numbers stored as int are indexed better than numbers stored as varchar/ char. This means faster searching.... but is really an exercise in proper data types for values stored.
 
Top