员工

金蝶EAS下员工和账号禁用SQL

不想你离开。 提交于 2020-03-01 05:44:51
--员工禁用账号没禁用 SELECT t.fname_l2 FROM t_pm_user t INNER JOIN t_bd_person t1 ON t1.fid = t.fpersonid AND t1.fdeletedstatus = 2 WHERE t.fforbidden = 0; --员工禁用后,禁用账号 UPDATE t_pm_user c SET c.fforbidden = 1 WHERE c.fid IN (SELECT t.fid FROM t_pm_user t INNER JOIN t_bd_person t1 ON t1.fid = t.fpersonid AND t1.fdeletedstatus = 2 WHERE t.fforbidden = 0); --账号禁用员工没禁用(一个员工可能对应多个账号) SELECT t.fname_l2, t.fid FROM t_pm_user t INNER JOIN t_bd_person t1 ON t1.fid = t.fpersonid AND t1.fdeletedstatus = 1 WHERE t.fforbidden = 1; -- 账号禁用后,禁用员工 UPDATE t_bd_person c SET c.fdeletedstatus = 2 WHERE c.fid IN (SELECT t