G
Guest
I have a Purchase Order table. It has a Product Code, PO Received Date and a
Unit Price Date field among other fields. I wan't to query the last unit
price at the end of the 2006 calendar year. How do I do that? I've tried to
select the product code and unit price and max of poreceiveddate to get the a
single record for each product with last time it was purchased and the last
price it was purchased at but the query pulls in multiple records for each
time there is a different price. How do I write the query so it only pulls
in the last record of last year with the price? Here is the code I'm using:
SELECT [Purchase Order].PCODE, Max([Purchase Order].PORECDATE) AS
MaxOfPORECDATE, [Purchase Order].POUNITPRICE
FROM [Purchase Order]
WHERE ((([Purchase Order].PORECDATE)<=#12/31/2006#))
GROUP BY [Purchase Order].PCODE, [Purchase Order].POUNITPRICE;
What am I missing? Why can't I get a single record for each product code?
Thanks for your help.
Scott
Unit Price Date field among other fields. I wan't to query the last unit
price at the end of the 2006 calendar year. How do I do that? I've tried to
select the product code and unit price and max of poreceiveddate to get the a
single record for each product with last time it was purchased and the last
price it was purchased at but the query pulls in multiple records for each
time there is a different price. How do I write the query so it only pulls
in the last record of last year with the price? Here is the code I'm using:
SELECT [Purchase Order].PCODE, Max([Purchase Order].PORECDATE) AS
MaxOfPORECDATE, [Purchase Order].POUNITPRICE
FROM [Purchase Order]
WHERE ((([Purchase Order].PORECDATE)<=#12/31/2006#))
GROUP BY [Purchase Order].PCODE, [Purchase Order].POUNITPRICE;
What am I missing? Why can't I get a single record for each product code?
Thanks for your help.
Scott