跳至主要內容

销售交货单:添加后根据业务伙伴数据自动更新对应的提成比例

五六零网校小于 1 分钟

UPDATE T1 :FROM后数据表别名即可

代码示例

--销售交货单:添加后根据业务伙伴数据自动更新对应的提成比例
IF @object_type = '15'
	BEGIN
		IF @transaction_type = 'A'
			BEGIN
				UPDATE T1
				SET T1.U_YWYBL = T2.U_YWBL, T1.[U_JLBL] = T2.[U_JLBL], T1.[U_NQBL] = T2.[U_NQBL], T1.[U_NDBL] = T2.[U_NDBL], T1.[U_ZDXKHBL] = T2.[U_KHBL], T1.[U_YJBFB] = T2.[U_YFBL]
				FROM ODLN T0
					INNER JOIN DLN1 T1 ON T1.DocEntry = T0.DocEntry
					LEFT JOIN (
						SELECT T0.[CardCode], T0.[U_YWBL], T0.[U_JLBL], T0.[U_NQBL], T0.[U_NDBL]
							, T0.[U_KHBL], T0.[U_YFBL]
						FROM OCRD T0
					) T2
					ON T2.CardCode = T0.CardCode
				WHERE T2.CARDCODE = T0.CardCode
					AND T0.[DocEntry] = @list_of_cols_val_tab_del;
			END;
	END