ต้องการเพิ่มเงื่อนไข SQLตามรูปที่อธิบายด้านล่างค่ะ
โดยตอนนี้โค้ดSQLที่เขียนได้Queryดังด้านล่างนี้ค่ะ
SELECT Receiving_SUM_month.ItemID, Receiving_SUM_month.Name,Receiving_SUM_month.Type, Receiving_SUM_month.DateIn AS [Date],
Receiving_SUM_month.QtyReceived AS [Qtyof Before - IN - OUT], Receiving_SUM_month.Task
FROM Receiving_SUM_month
LEFT JOIN Shipment_SUM_month
ON (Receiving_SUM_month.ItemID = Shipment_SUM_month.[Material/Part] AND Receiving_SUM_month.DateIn = Shipment_SUM_month.DateOut)
UNION SELECT Shipment_SUM_month.[Material/Part], Shipment_SUM_month.Name, Shipment_SUM_month.Type, Shipment_SUM_month.DateOut,
Shipment_SUM_month.QtyShip, Shipment_SUM_month.Task
FROM Receiving_SUM_month
RIGHT JOIN Shipment_SUM_month
ON (Receiving_SUM_month.ItemID = Shipment_SUM_month.[Material/Part] AND Receiving_SUM_month.DateIn = Shipment_SUM_month.DateOut)
UNION SELECT StockMonth_Before_Query.ItemID, StockMonth_Before_Query.Name, StockMonth_Before_Query.Type, StockMonth_Before_Query.[Stock date],
StockMonth_Before_Query.TotalBefore, StockMonth_Before_Query.Task
FROM Receiving_SUM_month
RIGHT JOIN StockMonth_Before_Query
ON (Receiving_SUM_month.ItemID = StockMonth_Before_Query.ItemID AND Receiving_SUM_month.DateIn = StockMonth_Before_Query.[Stock date]);