Here's the situation:
I have a "Supplies" table that tracks supplies and various information relative to those supplies. Two of those pieces of information are the [LatestPrice] and [LatestVendor].
I have a historical "Procurement" table that is populated every time a purchase is made. The Items purchased must be items that are in the "Supplies" table. It is populated with the [date], [price] and [vendor] for that particular purchase.
Now, I want to be able to run a query that will find the most recent procurement (based on the purchase dates in the "Procurements" table) for each item in "Supplies" and put the price and vendor info from those procurement records into the [LatestPrice] and [LatestVendor] fields of the "Supplies" table.
I thought this was going to be a piece of cake, but I can't figure out how to make it work.
Note: I believe I have to do it this way rather than always accessing the information directly from the "Procurements" table, because occasionally we will want to override the procurement information by going into the "Supplies" table and entering it directly into those fields. This happens when we know the price has changed but aren't ready to buy more yet.
Thank you.
I have a "Supplies" table that tracks supplies and various information relative to those supplies. Two of those pieces of information are the [LatestPrice] and [LatestVendor].
I have a historical "Procurement" table that is populated every time a purchase is made. The Items purchased must be items that are in the "Supplies" table. It is populated with the [date], [price] and [vendor] for that particular purchase.
Now, I want to be able to run a query that will find the most recent procurement (based on the purchase dates in the "Procurements" table) for each item in "Supplies" and put the price and vendor info from those procurement records into the [LatestPrice] and [LatestVendor] fields of the "Supplies" table.
I thought this was going to be a piece of cake, but I can't figure out how to make it work.
Note: I believe I have to do it this way rather than always accessing the information directly from the "Procurements" table, because occasionally we will want to override the procurement information by going into the "Supplies" table and entering it directly into those fields. This happens when we know the price has changed but aren't ready to buy more yet.
Thank you.