I have a table of this type:
table : people
+-------+-----------+-----------+-------------------+
| id | name | amount | date |
+-------+-----------+-----------+-------------------+
| 1 | John | 12 | 2011-12-03 |
| 2 | John | 7 | 2016-02-01 |
| 3 | Mary | 0 | 2014-06-23 |
| 4 | John | 7 | 2016-01-01 |
| 4 | Mary | 5 | 2014-06-01 |
| 4 | Bill | 1 | 2010-08-14 |
+-------+-----------+-----------+-------------------+
I need to write a query to select the record with the highest date for each name.
The result will be:
+-----------+-----------+-------------------+
| name | amount | date |
+-----------+-----------+-------------------+
| John | 7 | 2016-02-01 |
| Mary | 0 | 2014-06-23 |
| Bill | 1 | 2010-08-14 |
+-----------+-----------+-------------------+