原有表中的点击次数用的是 字符串型,现要求按点击次数排序,

select  *  from table t order by  t.click desc

查出的是按左对齐排序的

99
97
9
89
783
7

而我要求的是按数字大小排的序

要修改为

select  *  from table t order by  cast   (t.click   as   int) desc

783
99
97
89
9
7

结果正确.

posted on 2008-03-11 11:24  大口仔  阅读(1292)  评论(2)    收藏  举报

使用Live Messenger联系我
关闭