I have a table with two fields – a field for "date" entered as day/month/year and a field "rate"
date | rate
24/01/05 | 1.9754
26/01/05 | 1.3723
…
and so on
So, I like to find minimum and maximum values of "rate" for each month of year(s). My query selects only one row
SELECT DISTINCT DATE_FORMAT(date, ‘%d-%m-%y’) as Date, MIN(rate) as r, MAX(rate) as mr FROM rates
This will get the rate values for each month and year
If you need to have the individual date(s) on which the min or max occurs you’ll need some additional grouping in there, however the above should suffice for your original question.