select * from 表 order by year(你的时间列),month(你的时间列)

解决方案 »

  1.   

    Cast (年月 as varchar)
      

  2.   

    CONVERT(char(10), GETDATE(), 102)可进格式化转换。具体可看联机手册。
      

  3.   

    select * from 表 
    group by year(你的时间列),month(你的时间列) 
    order by year(你的时间列),month(你的时间列)
      

  4.   

    select cast(year('2003-09-23') as varchar(4))
    select cast(month('2003-09-23') as varchar(2))select cast(datepart(yy,'2003-09-23') as varchar(4))
    select cast(datepart(mm,'2003-09-23') as varchar(2))上面显示结果都是字符串形式
      

  5.   

    declare  @yearmonth char(6)
    select @yearmonth=convert(char(6),getdate(),112)