รบกวนดูให้ทีครับ ถามไมผมรันแล้วมันขึ้นว่า syntax error in union query ครับ พอดีผมเป็นมือใหม่หนะครับ ไม่เคยเขียนโปรแกรมเลย ถ้าผิดอะไรยังไงช่วยแนะนำให้ทีครับ ขอบคุณครับ
(SELECT dbo_Transfer.Timestamp as date , dbo_TransferList.Amount, 1 as Type
FROM (dbo_Transfer
INNER JOIN dbo_TransferList
ON dbo_Transfer.ID = dbo_TransferList.TransferID)
INNER JOIN dbo_Lot
ON dbo_TransferList.LotID = dbo_Lot.ID
where dbo_Lot.ProductID = 8)
UNION
(SELECT dbo_order.timestamp as date, dbo_orderList.quantity as Amount, 2 as Type
FROM (dbo_Order
INNER JOIN dbo_OrderList
ON dbo_Order.id = dbo_Orderlist.orderid
where dbo_orderlist.productID = 8)
UNION
(SELECT dbo_return.timestamp as date, dbo_orderlist.quantity as Amount, 3 as Type
FROM (dbo_Return
INNER JOIN dbo_returnlist
ON dbo_return.id = dbo_returnlist.returnid
where dbo_returnlist.productID = 8)
สอบถามเรื่อง SQL ทีครับ
(SELECT dbo_Transfer.Timestamp as date , dbo_TransferList.Amount, 1 as Type
FROM (dbo_Transfer
INNER JOIN dbo_TransferList
ON dbo_Transfer.ID = dbo_TransferList.TransferID)
INNER JOIN dbo_Lot
ON dbo_TransferList.LotID = dbo_Lot.ID
where dbo_Lot.ProductID = 8)
UNION
(SELECT dbo_order.timestamp as date, dbo_orderList.quantity as Amount, 2 as Type
FROM (dbo_Order
INNER JOIN dbo_OrderList
ON dbo_Order.id = dbo_Orderlist.orderid
where dbo_orderlist.productID = 8)
UNION
(SELECT dbo_return.timestamp as date, dbo_orderlist.quantity as Amount, 3 as Type
FROM (dbo_Return
INNER JOIN dbo_returnlist
ON dbo_return.id = dbo_returnlist.returnid
where dbo_returnlist.productID = 8)