update a set C213I=b.s from a, (select id, sum( isnull(C211I,0) ) s from 部门 group by a.id ) b where 部门id=b.id
你为什么要group by a.id?
case when [计划出勤小时] >10 then case when [计划出勤小时] <10 and [计划出勤小时]>3 then case when [计划出勤小时] >3 then 0.7 else 1 end else 0.5 end else 0 end 这个语法没有错误,但计算没有数值。case when [计划出勤小时] >10 then 0 when [计划出勤小时] =10 and [计划出勤小时] <3 then 0.7 when ****** end 可以计算有数据是什么原因
update a set C213I=sum( isnull(C211I,0) ) from 部门 join a where 部门id=a.id group by a.id
update a set C213I=sum( isnull(C211I,0) ) from 部门 join a on 部门id=a.id group by a.id 写错了 不好意思 应该是on
case when [计划出勤小时] >10 then -- 这时候 > 10 case when [计划出勤小时] <10 and [计划出勤小时]>3 then -- 永远进不来 case when [计划出勤小时] >3 then 0.7 else 1 end else -- 所以 > 10 时返回这个 0.5 end else -- 所以 <= 10 时返回这个 0 end
update a set C213I=b.s from a, (select id, sum( isnull(C211I,0) ) s from 部门 group by a.id ) b where 部门id=b.id
set C213I=b.s
from a,
(select id, sum( isnull(C211I,0) ) s
from 部门
group by a.id
) b
where 部门id=b.id
[计划出勤小时] >10 then
case when
[计划出勤小时] <10 and [计划出勤小时]>3 then
case when
[计划出勤小时] >3 then 0.7
else 1
end
else 0.5
end
else 0
end
这个语法没有错误,但计算没有数值。case when [计划出勤小时] >10 then 0
when [计划出勤小时] =10 and [计划出勤小时] <3 then 0.7
when ******
end
可以计算有数据是什么原因
set C213I=sum( isnull(C211I,0) ) from 部门 join a
where 部门id=a.id
group by a.id
set C213I=sum( isnull(C211I,0) ) from 部门 join a
on 部门id=a.id
group by a.id 写错了 不好意思 应该是on
-- 这时候 > 10
case when [计划出勤小时] <10 and [计划出勤小时]>3 then
-- 永远进不来
case when
[计划出勤小时] >3 then 0.7
else 1
end
else
-- 所以 > 10 时返回这个
0.5
end
else
-- 所以 <= 10 时返回这个
0
end
set C213I=b.s
from a,
(select id, sum( isnull(C211I,0) ) s
from 部门
group by a.id
) b
where 部门id=b.id