select distinct  Convert(Varchar(7),UploadDate,120) as Sort_Month from [upload] order by UploadDate desc -----选出不同的Sort_Month

解决方案 »

  1.   

    不行...出错Microsoft OLE DB Provider for SQL Server (0x80040E14)
    如果指定了 SELECT DISTINCT,那么 ORDER BY 子句中的项就必须出现在选择列表中
      

  2.   

    ---这样:
    select distinct  Convert(Varchar(7),UploadDate,120) as Sort_Month from [upload] order by Convert(Varchar(7),UploadDate,120) desc
      

  3.   

    order by Convert(Varchar(7),UploadDate,120)这样只可以按年月进行排序..如果想按原来UploadDate字段值进行排序.如何做?
      

  4.   

    select distinct * from 
    (
    select Convert(Varchar(7),UploadDate,120) as Sort_Month from [upload] order by UploadDate desc
    )a
      

  5.   

    select distinct  Convert(Varchar(7),UploadDate,120) as Sort_Month,UploadDatefrom [upload] order by UploadDate desc为了增加数据的可读性,你可以在查询中加入这个字段,然后再按这个字段desc就可以啦