本帖最后由 aaipan8 于 2013-07-19 10:30:27 编辑

解决方案 »

  1.   


    select 
    (select SUM(fraction) from test88 
    where isType=1 and 
    CONVERT(varchar(10),a.operateTime,20)=CONVERT(varchar(10),operateTime,20)) 增加,
    (select SUM(fraction) from test88 
    where isType=2 and 
    CONVERT(varchar(10),a.operateTime,20)=CONVERT(varchar(10),operateTime,20)) 增加,
    [operateTime] 时间 from test88 a这样查就行
      

  2.   

    感觉有点难懂,Mark一下再说。
      

  3.   

    try this,select sum(case when isType=1 then fraction else 0 end) '增加',
           sum(case when isType=2 then fraction else 0 end) '减少',
           convert(varchar(10),operateTime,20) '时间'
     from test88 
     group by convert(varchar(10),operateTime,20)