我想要连接我的表product_sales和product。然而,产品编号似乎模棱两可。以下是我的代码,请告诉我哪里写错了谢谢你
INSERT INTO HSD_DW.PRODUCT_SALES
SELECT UNIX_TIMESTAMP(TimeID) AS TimeID, CustomerID, ProductNumber,
SUM(Quantity) AS TotalQty, UnitPrice, SUM(Quantity) * UnitPrice AS Total
FROM HSD.PRODUCT_SALES AS PS
INNER JOIN hsd.product AS P ON PS.ProductNumber = P.ProductNumber
GROUP BY TimeID, CustomerID, ProductNumber, UnitPrice
ORDER BY TimeID;
位置"PS."参考"产品编号"前;列。
INSERT INTO HSD_DW.PRODUCT_SALES
SELECT UNIX_TIMESTAMP(TimeID) AS TimeID, CustomerID, PS.ProductNumber,
SUM(Quantity) AS TotalQty, UnitPrice, SUM(Quantity) * UnitPrice AS Total
FROM HSD.PRODUCT_SALES AS PS
INNER JOIN hsd.product AS P ON PS.ProductNumber = P.ProductNumber
GROUP BY TimeID, CustomerID, PS.ProductNumber, UnitPrice
ORDER BY TimeID;