M
MacLean
I’m trying to create a query to track the product that is in-transit to the customers
I have 2 tables to get the data from and calculate the in-transit qty to each customer location for each product
Table1 is built from a daily shipments data file sent by our shipping warehouses to provide the qty shipped for each product to each customer location
CustPartNo, PartNo, CustLocation, QtyShipped, TranDat
Table2 is built from a daily receipts data file sent by the customers to provide the qty received for each product
CustPartNo, CustLocation, QtyReceived, TranDat
The query should contain the following fields
CustLocation, TranDate, CustPartNo, PartNo, QtyShipped, QtyReceived, QtyInTransi
For each customer location, a new record should be generated for each product that was shipped AND/OR received. All records from both tables should be in the query, but those where the CustLocation, TranDate and CustPartNo match; should appear only once. The QtyInTransit should be calculated as follows
QtyInTransit = QtyIntransit (from the most recent record that matches the CustPartNo and CustLocation) + QtyShipped – QtyReceive
What’s the proper way to join these 2 tables so that all records from each table are picked up without duplicating the ones with the same CustLocation, TranDate and CustPartNo
How can I get the QtyInTransit from the most recent record that matches the CustPartNo and CustLocation to use in the calculation for the QtyInTransit of the current record? (0 should be assumed if no previous record is found
Thanks for your help!!
I have 2 tables to get the data from and calculate the in-transit qty to each customer location for each product
Table1 is built from a daily shipments data file sent by our shipping warehouses to provide the qty shipped for each product to each customer location
CustPartNo, PartNo, CustLocation, QtyShipped, TranDat
Table2 is built from a daily receipts data file sent by the customers to provide the qty received for each product
CustPartNo, CustLocation, QtyReceived, TranDat
The query should contain the following fields
CustLocation, TranDate, CustPartNo, PartNo, QtyShipped, QtyReceived, QtyInTransi
For each customer location, a new record should be generated for each product that was shipped AND/OR received. All records from both tables should be in the query, but those where the CustLocation, TranDate and CustPartNo match; should appear only once. The QtyInTransit should be calculated as follows
QtyInTransit = QtyIntransit (from the most recent record that matches the CustPartNo and CustLocation) + QtyShipped – QtyReceive
What’s the proper way to join these 2 tables so that all records from each table are picked up without duplicating the ones with the same CustLocation, TranDate and CustPartNo
How can I get the QtyInTransit from the most recent record that matches the CustPartNo and CustLocation to use in the calculation for the QtyInTransit of the current record? (0 should be assumed if no previous record is found
Thanks for your help!!