我有一个这种类型的表:
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 |
+-------+-----------+-----------+-------------------+
我需要编写一个查询来选择每个名称具有最高日期的记录。
结果将是:
+-----------+-----------+-------------------+
| name | amount | date |
+-----------+-----------+-------------------+
| John | 7 | 2016-02-01 |
| Mary | 0 | 2014-06-23 |
| Bill | 1 | 2010-08-14 |
+-----------+-----------+-------------------+