View Single Post
  #1 (permalink)  
Old 11-07-2007, 03:55 AM
MOON MOON is offline
WebProWorld New Member
 

Join Date: Oct 2007
Posts: 8
MOON RepRank 0
Default Trouble getting latest record for a given item

I haven't found the information I seek in the manual yet, but I
continue to look. I am hoping that someone will give me a clue in the
mean time; hoping to shorten the time I need to fix this.

I tried the following:

SELECT *, max(price_date) FROM prices GROUP BY product_id WHERE
product_id = 1 AND price_date = max(price_date);

There is no knowing what the latest date is for a given item in the
DB.

But if I don't have the GROUP BY clause I get an error about misusing
max(), and using it, I still get an uninformative error about my WHERE
clause.

What I want ought to be obvious: the latest price for a given
product. How do I fix this SELECT statement to get what I want?

Thanks
_________________
Black Box Products Distributor How to trace a telephone number
Reply With Quote