Hi everone!

I have two tables.
One with items (ID, Items name etc.)
second one which conteins tiemstamp and price and of course ID of the items.

What I need is to find last items price from selected period.

Here's how i do it now:

select
tblItems.item_ID,
tblItems.Item_Name,
(Select tblPrices.Price from tblPrices where tblPrices.DateTime =  
  (select max(tblPrices.DateTime) from tblPrices 
   where tblPrices.Item_id = tblItems.item_ID and tblPrices.DateTime
   between '2011-01-01' and '2011-06-30') 
   and tblPrices.Item_id = tblItems.item_ID) as LastPreis
from tblItems
order by tblItems.Item_Name

and of course it works. 
But is there any easiest way??

Piotr 

Reply via email to