select avg(列) from 表 where datediff(month,时间,getdate())=0

解决方案 »

  1.   

    select CONVERT(varchar(10), getDate(),120) --不要时间2002-1-1
    select convert(char(8),getdate(),112) ----20020101
    select convert(char(8),getdate(),108)  ---06:05:05select avg(列) from 表 where CONVERT(varchar(7),时间,120)='2003-11'
      

  2.   

    select cast(round(80*1.0/30,0) as int)select cast(round(avg(字段*1.0),0) as int) from 表
      

  3.   

    select cast(round(avg(字段*1.0),0) as int) as avg where convert(varchar(6),date,112)='200310'
      

  4.   

    1: select cast(80*1.0/30+0.5 as int)
    2: select cast(round(80*1.0/30,0) as int)