用友u8财务3
--部门比例构成表中同一个卡片是否有多条记录.
select scardnum
from fa_DeptScale
group by scardnum
having(count(*))>1
--是否多部门使用
select * from fa_cards
where bmultidept!=0
--根据部门属性表更新部门比例构成表
update fa_deptscale
set sdeprsubjectnum=b.ssubjectnum,sdeprsubjectname=b.ssubjectname
from fa_deptscale a join fa_Departments b on a.sdeptnum=b.snum
--等同
update fa_deptscale
set sdeprsubjectnum=(select ssubjectnum from fa_Departments where fa_Departments.snum=fa_deptscale.sdeptnum),sdeprsubjectname=(select ssubjectname from fa_Departments where fa_Departments.snum=fa_deptscale.sdeptnum)
from fa_Departments,fa_deptscale