Select after Union?

jedooley

Registered User.
Local time
Today, 16:01
Joined
Sep 22, 2004
Messages
20
I have this Union Query that works great. I want to run a select statement right after it. Can someone tell me if my syntx is wrong or the sub query is wrong. The Union works great on its own.


SELECT TOP 1 Inventory.Inventory_ID, Location.Location_Name, Product.Product_Name, Inventory.InvDate, Inventory.Opening
FROM (Product INNER JOIN (Location INNER JOIN Inventory ON Location.Location_ID = Inventory.Location_ID) ON Product.[Product _ID] = Inventory.Product_ID) INNER JOIN Rail_Stock_Transfers ON Product.[Product _ID] = Rail_Stock_Transfers.Product_ID
WHERE (((Inventory.Product_ID)=1) AND ((Inventory.Location_ID)=1))
ORDER BY Inventory.Inventory_ID DESC

UNION (SELECT TOP 1 Inventory.Inventory_ID ,Location_Name,Product_Name, Inventory.InvDate,opening
FROM Location INNER JOIN (Product INNER JOIN Inventory ON Product.[Product _ID] = Inventory.Product_ID) ON Location.Location_ID = Inventory.Location_ID
WHERE Inventory.product_ID=1 AND Inventory.Location_ID=2
ORDER BY Inventory.Inventory_ID DESC)

UNION (SELECT TOP 1 Inventory.Inventory_ID ,Location_Name,Product_Name, Inventory.InvDate,opening
FROM Location INNER JOIN (Product INNER JOIN Inventory ON Product.[Product _ID] = Inventory.Product_ID) ON Location.Location_ID = Inventory.Location_ID
WHERE Inventory.product_ID=2 AND Inventory.Location_ID=2
ORDER BY Inventory.Inventory_ID DESC)

(SELECT Sum([volume]) AS En_Routes
FROM Rail_Stock_transfers
WHERE ((([Rail_Stock_transfers].[Date_Rec_Edm]) Is Null)));
 

Users who are viewing this thread

Back
Top Bottom