View Full Version : Max


mugman17
05-26-2002, 12:26 PM
I want to find the maximum price between two dates. When I do this, I get the maximum price for each date within the two dates. I just want the highest price in the table within the two dates. How do I go about this?

Thanks in advance.

RV
05-26-2002, 01:00 PM
I guess you're using MAX(Price) and a Date column in your query.
That's the reason why you're getting more Max Prices as each combination of your Date column and price column is unique..

Either drop the Date column from your query or use a subquery.

Basic statement using a subquery:

SELECT YourDateColumn, Price
FROM YourTable
WHERE Price =
(SELECT Max(Price)
FROM YourTable AS YourTable1
WHERE YourTable1.YourDateColumn BETWEEN YourStartDate AND YourEndDate);

RV