0

我想按升序排列 est_dilt_pple 表。

   pub_name                               est_dily_pple
    Jex Max Publication                         11530
    BPP Publication Mumbai                  123500    
    New Harrold Publication                     12563
    Ultra Press Inc.                            9500
    Mountain Publication                        9300
    Summer Night Publication                    53698
    Pieterson Grp. of Publishers                50000

我试过这个

SELECT * FROM publisher ORDER BY est_dily_pple ASC;

结果

pub_name                               est_dily_pple
Jex Max Publication                         11530
BPP Publication Mumbai                  123500
New Harrold Publication                     12563
Pieterson Grp. of Publishers                50000    
Summer Night Publication                    53698
Mountain Publication                        9300
Ultra Press Inc.                            9500

问题

但它不是上升的。“123500”不止,应该显示在底部。请帮帮我!

4

2 回答 2

4

看起来该列是 text 或 varchar 类型,具有字符串排序语义。

将其设为整数或数字类型,您会做得更好。

于 2013-06-06T09:54:28.763 回答
0

最好的解决方案是使列的数据类型为est_dily_pple数字。或者你可以试试这个:

SELECT * FROM publisher ORDER BY CAST(est_dily_pple as SIGNED INTEGER) ASC
于 2013-06-06T09:56:00.757 回答