解决方案 »

  1.   


    v3 是视图,是working表与users表组成的视图
      

  2.   

    --那马,统一使用视图的数据查询就可以了:
    select distinct
    sum(case when groupid=20 then 分数+isnull(技术分数,0) else 0 end) as zf1,
    sum(case when groupid=20 then 分数+isnull(技术分数,0) else 0 end) as zf2,
    sum(case when leaderID=127 and done='true' then convert(float,分数) else 0 end) as ydf1,
    sum(case when leaderID=128 and done='true' then convert(float,分数) else 0 end) as ydf2
    from [WORK].[dbo].[v3] as a 
    where  groupID<>0  
    and ztstartTime between '2014-03-01' and '2015-02-05'