olorin
Registered User.
- Local time
- Today, 19:55
- Joined
- Jun 9, 2006
- Messages
- 81
I know nothing of SQL, the following code is what appears after I made the query in design view then switched to SQL view; (I named the query "qryProductsShipped")
SELECT DISTINCT tblShipments.Product, tblShipments.NumberOfPallets, tblShipments.PartsPerPallet, [NumberOfPallets]*[PartsPerPallet] AS Shipped
FROM tblShipments
GROUP BY tblShipments.Product, tblShipments.NumberOfPallets, tblShipments.PartsPerPallet
That works fine in as much as it gives me totals shipped for each ProductID.
So if a product has shipped a dozen times, it will appear 12 times in the Datasheet View along with the other shipped products.
I then did this;
SELECT qryProductsShipped.Product, Sum(qryProductsShipped.shipped) AS SumOfshipped
FROM qryProductsShipped
GROUP BY qryProductsShipped.Product;
Which is even better, as it then Totals all shipments per product and each ProductID has the total shipped alongside it.
My Problem (and has been for the past week), is how to get the results from the second query ("qryShippedProducts.SumOfShipped") to update to a particular field named "NumShipped" in "tblProducts".
I have tried Inner joins Outer Joins Right Joins Left Joins until I am blue in the face. All to no avail.
Your guidance in this is greatly needed and any advice much appreciated.
If my table design would help in your response, you may view a jpeg of it here
SELECT DISTINCT tblShipments.Product, tblShipments.NumberOfPallets, tblShipments.PartsPerPallet, [NumberOfPallets]*[PartsPerPallet] AS Shipped
FROM tblShipments
GROUP BY tblShipments.Product, tblShipments.NumberOfPallets, tblShipments.PartsPerPallet
That works fine in as much as it gives me totals shipped for each ProductID.
So if a product has shipped a dozen times, it will appear 12 times in the Datasheet View along with the other shipped products.
I then did this;
SELECT qryProductsShipped.Product, Sum(qryProductsShipped.shipped) AS SumOfshipped
FROM qryProductsShipped
GROUP BY qryProductsShipped.Product;
Which is even better, as it then Totals all shipments per product and each ProductID has the total shipped alongside it.
My Problem (and has been for the past week), is how to get the results from the second query ("qryShippedProducts.SumOfShipped") to update to a particular field named "NumShipped" in "tblProducts".
I have tried Inner joins Outer Joins Right Joins Left Joins until I am blue in the face. All to no avail.
Your guidance in this is greatly needed and any advice much appreciated.
If my table design would help in your response, you may view a jpeg of it here