日期:2014-05-18 浏览次数:20548 次
INSERT INTO ProductCode (ProductID, SupplierID, ProductCode, ConvertRate) SELECT PorderImport.MEDICAL_CODE, PorderImport.SALER_CODE, PorderImport.MEDICAL_CODE AS Expr2, 1 AS Expr1 FROM ProductCode AS ProductCode_1 RIGHT OUTER JOIN PorderImport INNER JOIN Supplier ON PorderImport.SALER_CODE = Supplier.SupplierID INNER JOIN Product ON PorderImport.MEDICAL_CODE = Product.ProductID ON ProductCode_1.ProductID = PorderImport.MEDICAL_CODE AND ProductCode_1.SupplierID = PorderImport.SALER_CODE WHERE (ProductCode_1.ProductID IS NULL) AND (Supplier.Discontinued = 0) AND (Supplier.Status = N'2') AND (Supplier.EPS = 1) GROUP BY PorderImport.MEDICAL_CODE, PorderImport.SALER_CODE