大家早上好。我正在创建一个MySQL命令 做这个输出。
但是当我尝试时,输出就是这个。
这是我的代码。
select purchorder.PONo,purchorder.ItemCode,purchorder.Description,
purchorder.OrderQty,
receiving.ItemCode,receiving.Description,Receiving.ReceivedQty from purchorder
LEFT OUTER JOIN Receiving on receiving.RIno = purchorder.RINumber where
purchorder.PONo = 'P0239ROI'
Group BY purchorder.ItemCode;
表PurchOrder
表格Rceiving
如何实现上述输出? (使用黄色标题)
以下是最新可能的答案
答案 0 :(得分:0)
您可以实现这一点,只需删除group by
子句并在receiving.RIno
子句中添加SELECT
。
SELECT DISTINCT
purchorder.PONo,
purchorder.ItemCode,
purchorder.Description,
purchorder.OrderQty,
receiving.RIno,
receiving.ItemCode,
receiving.Description,
Receiving.ReceivedQty
FROM purchorder
LEFT JOIN Receiving ON receiving.RIno = purchorder.RINumber
AND Receiving.ItemCode = purchorder.ItemCode
WHERE purchorder.PONo = 'P0239ROI'