Hi all, new here. Just wondering where to post on creating an SQL Query.

I will leave it here but would like to put it where it belongs also.

I am trying to get a price for an item for historical prices. I have the following tables:

TxnTable- a. ItemIdentifier b. ItemCode c. SellDate d. Purchaser

PriceHistory a. PriceIdentifier b. ItemCode c. Price d. PriceChangeDate

I need to look at some items in the TxnTable and get the price for the items, to determine the total sales during a year. Here is what I need to do.

A. Take the ItemCode and SellDate from the TxnTable B. Compare that to the PriceChangeDate and ItemCode in the PriceHistoryTable to obtain the price of the item at that time.

This needs to be done for hundreds of the same ItemCodes as well as to loop it through for multiple items.

And before you ask- the InvoiceTable is not present or has been Corrupted so I cannot look for it there.

Thanks in advance.