id / name / date
1 / Дима / 2017
2 / Дима / 2018
3 / Саша / 2017
4 / Саша / 2018
SELECT id,name,MAX(date) FROM table GROUP BY name;
MariaDB [test]> select * from t1;
+------+-------+------+
| id | name | date |
+------+-------+------+
| 1 | Dima | 2017 |
| 2 | Dima | 2018 |
| 3 | Sasha | 2017 |
| 4 | Sasha | 2018 |
+------+-------+------+
4 rows in set (0.00 sec)
MariaDB [test]> SELECT id,name,MAX(date) FROM t1 GROUP BY name;
+------+-------+-----------+
| id | name | MAX(date) |
+------+-------+-----------+
| 1 | Dima | 2018 |
| 3 | Sasha | 2018 |
+------+-------+-----------+
2 rows in set (0.00 sec)