sql 字符+数值 混合排序


if object_id('[tb]') is not null drop table [tb]
go
create table [tb]([col] varchar(3))

insert [tb]
select '2' union
select 'b2' union
select 'a3' union
select 'b1' union
select '5b' union
select '5a' union
select '3' union
select 'a2' union
select 'a1' union
select '1' union
select '0'
go


select *
from tb
order by [col] asc


/*
0
1
2
3
5a
5b
a1
a2
a3
b1
b2
*/

 

原来默认排序就是对的,晕。。

posted on 2012-12-26 15:03  lcs-帅  阅读(632)  评论(0编辑  收藏  举报

导航