为什么说“因为该列没有包含在聚合函数或 GROUP BY 子句中”
INSERT INTO PorderSub(LineID,PorderID,ProductID,ProductSN,ProductCode,ProductName,Spec,Manufactory,ApprovalID,InsuranceID,PackRate1,PackRate2,ConvertRate,RequestQuantity,RequestPrice,RequestAmount,Quantity,Price,Amount,Remark)Select ROW_NUMBER() OVER(ORDER BY ProductID),PorderID,ProductID,ProductSN,ProductCode,ProductName,Spec,Manufactory,ApprovalID,InsuranceID,PackRate1,PackRate2,ConvertRate,SUM(RequestQuantity),RequestPrice,SUM(RequestAmount),SUM(Quantity),Price,SUM(Amount),RemarkFrom #PorderSubGroup By ProductID,PorderID,ProductSN,ProductCode,ProductName,Spec,Manufactory,InsuranceID,PackRate1,PackRate2,ConvertRate,RequestPrice,Price,Remark
你漏了INTO PorderSub(LineID,PorderID,ProductID,ProductSN,ProductCode,ProductName,Spec,Manufactory,ApprovalID,InsuranceID,PackRate1,PackRate2,ConvertRate,RequestQuantity,RequestPrice,RequestAmount,Quantity,Price,Amount,Remark)Select ROW_NUMBER() OVER(ORDER BY ProductID),PorderID,ProductID,ProductSN,ProductCode,ProductName,Spec,Manufactory,ApprovalID,InsuranceID,PackRate1,PackRate2,ConvertRate,SUM(RequestQuantity),RequestPrice,SUM(RequestAmount),SUM(Quantity),Price,SUM(Amount),RemarkFrom #PorderSubGroup By ProductID,PorderID,ProductSN,ProductCode,ProductName,Spec,Manufactory,ApprovalID,InsuranceID,PackRate1,PackRate2,ConvertRate,RequestPrice,Price,Remark
[解决办法]
group by PorderID,ProductID,ProductSN,ProductCode,ProductName,Spec,Manufactory,ApprovalID,InsuranceID,PackRate1,PackRate2,ConvertRate,RequestPrice,Price,Remark