mysql的查询语句,可以把结果以2007-03类似的格式查询出来。。
select DATE_FORMAT(MonDate,'%Y-%m') as anaMonth from mon_log where GroupNo=? group by anaMonth order by anaMonth desc;我想问同样的要求,在sql server2000里面怎么写??

解决方案 »

  1.   

    更正一下。。
    ....where GroupNo='1' group by ....
      

  2.   

    select convert(varchar(7),getdate(),120)
      

  3.   

    select convert(varchar(7),时间字段,120) as 时间字段 , max , sum ...
    from tb
    group by convert(varchar(7),时间字段,120)
      

  4.   

    120 121兩種格式都可以Select Convert(Varchar(7), GetDate(), 120)
    Select Convert(Varchar(7), GetDate(), 121)
    --Result
    /*
    2007-03
    */
      

  5.   

    你的語句可以這麼寫select Convert(Varchar(7), GetDate(), 121) as anaMonth from mon_log where GroupNo=? group by Convert(Varchar(7), GetDate(), 121) order by anaMonth desc