create view aaa as
select jilh,zhih,yusp,xianj,yusp+xianj col1,pingjpj,(pingjpj*100)-(yusp+xianj) col2 from tshoupdjgl s
left join
(select xianlcxdm,pingjpj from txianlcxxx where zhuangt='0') x
on s.xianlh=x.xianlcxdm where mod((yusp+xianj),pingjpj)<>0 and caozlx='0';
update tshoupdjgl a set a.xianj=(select aaa.col2 from aaa where aaa.jilh=a.jilh)
where exists (select 1 from aaa where a.jilh=aaa.jilh);
select jilh,zhih,yusp,xianj,yusp+xianj col1,pingjpj,(pingjpj*100)-(yusp+xianj) col2 from tshoupdjgl s
left join
(select xianlcxdm,pingjpj from txianlcxxx where zhuangt='0') x
on s.xianlh=x.xianlcxdm where mod((yusp+xianj),pingjpj)<>0 and caozlx='0';
update tshoupdjgl a set a.xianj=(select aaa.col2 from aaa where aaa.jilh=a.jilh)
where exists (select 1 from aaa where a.jilh=aaa.jilh);
SET xianj = (( SELECT pingjpj
FROM txianlcxxx x
WHERE zhuangt='0'
AND s.jilh=x.jilh )
* 100 ) - (yusp + xianj)
WHERE caozlx='0'
AND EXISTS ( SELECT 1 FROM txianlcxxx xx
WHERE zhuangt='0'
AND s.jilh=xx.jilh
AND MOD((yusp+xianj),xx.pingjpj) <> 0 )