petejigsaw
MIS
I am working on a report to pull pricing data from a table.
The table contains records of pricing data for each product, as follows:
Prod_Code Promo_No. Effective_Date Price
BERGCHSTBROW 444 299.00
BERGCHSTBROW 001 01/10/2011 259.00
BERGCHSTBROW 001 01/12/2011 299.00
BERGCHSTBROW 001 01/01/2012 249.00
In the above sample data, the record with 'Promo_type' set to 444 is the master price record (Comparison highest price charged for the product), and always needs to be returned (there is only one of these records for every 'Product_code'.
However, I also need to return the most recent record where 'Promo_type' is equal to 001 - i.e. the record with the most recent 'Effective_date'.
Once I have these records in the report, I then need to amalgamate the 2 records into a single line (probably by grouping) to give me a line showing the product_code, comparison highest ever price and the most recent and therefore current price for the product.
I have looked at the but can't seem to get either my head or my requirements to fit it!
Any help gratefully received.
Thanks
The table contains records of pricing data for each product, as follows:
Prod_Code Promo_No. Effective_Date Price
BERGCHSTBROW 444 299.00
BERGCHSTBROW 001 01/10/2011 259.00
BERGCHSTBROW 001 01/12/2011 299.00
BERGCHSTBROW 001 01/01/2012 249.00
In the above sample data, the record with 'Promo_type' set to 444 is the master price record (Comparison highest price charged for the product), and always needs to be returned (there is only one of these records for every 'Product_code'.
However, I also need to return the most recent record where 'Promo_type' is equal to 001 - i.e. the record with the most recent 'Effective_date'.
Once I have these records in the report, I then need to amalgamate the 2 records into a single line (probably by grouping) to give me a line showing the product_code, comparison highest ever price and the most recent and therefore current price for the product.
I have looked at the but can't seem to get either my head or my requirements to fit it!
Any help gratefully received.
Thanks