I am trying to select the non repeated records of my database, and if there is one repeated, choose the one with the soonest date. To do so, I have tried the following query:
SELECT name, MIN(date) FROM `table` GROUP BY number_offer ORDER BY `date` ASC
and then, showing them like this:
echo $row['fecha'];
echo $row['name'];
The query selects correctly all the non repeated records but fails at selecting the sooner date (it says 'undefined index "date"'). Do you have any idea of how to do that?