if object_id('tb') is not null drop table tb go create table tb(A int, B int) insert into tb select 2007,1 union all select 2007,10 union all select 2007,2 union all select 2007,4 union all select 2007,3 union all select 2007,5 union all select 2008,2 union all select 2007,1 select A,B from tb order by A,B
字符型月份的话 select * from 表 order by a+right('0'+b,2)
------------加个DESC if object_id('tb') is not null drop table tb go create table tb(A int, B int) insert into tb select 2007,1 union all select 2007,10 union all select 2007,2 union all select 2007,4 union all select 2007,3 union all select 2007,5 union all select 2008,2 union all select 2007,1 select A,B from tb order by A,B DESC
order by a,b
drop table tb
go
create table tb(A int, B int)
insert into tb
select 2007,1 union all
select 2007,10 union all
select 2007,2 union all
select 2007,4 union all
select 2007,3 union all
select 2007,5 union all
select 2008,2 union all
select 2007,1
select A,B from tb
order by A,B
select * from 表
order by a+right('0'+b,2)
if object_id('tb') is not null
drop table tb
go
create table tb(A int, B int)
insert into tb
select 2007,1 union all
select 2007,10 union all
select 2007,2 union all
select 2007,4 union all
select 2007,3 union all
select 2007,5 union all
select 2008,2 union all
select 2007,1
select A,B from tb
order by A,B DESC