IF EXISTS (SELECT 1 FROM INSERTED t1 INNER JOIN DELETED t2 ON t1.ID = t2.ID AND t1.FlagColumn = 10 AND t2.FlagColumn = 5) BEGIN UPDATE t1 SET t1.FlagColumn = 3,t1.完成人=t2.完成人,t1.完成时间=t2.完成时间 FROM TDZ_订单表_订单内容 t1 INNER JOIN INSERTED t2 ON t1.流水号 = t2.流水号 and t1.Flagcolumn <> 3 END IF EXISTS (SELECT 1 FROM INSERTED t1 INNER JOIN DELETED t2 ON t1.ID = t2.ID AND t1.FlagColumn = 5 AND t2.FlagColumn = 0) BEGIN if exists( SELECT 1 FROM TDZ_订单表 t1 INNER JOIN INSERTED t2 ON t1.ID = t2.ID AND (t1.审核人 is null or t1.审核人 = '')) UPDATE t1 SET t1.FlagColumn = 2 FROM TDZ_订单表 t1 INNER JOIN INSERTED t2 ON t1.ID = t2.ID and t1.Flagcolumn = 5 END
求详细解释,多谢