akretschmer
Datenbank-Guru
- Beiträge
- 10.372
Code:
mysql> select * from demo;
+------+------+
| c | val |
+------+------+
| a | 10 |
| b | 10 |
| a | 20 |
| c | 30 |
+------+------+
4 rows in set (0.00 sec)
mysql> select c, max(val) from (select * from demo order by c asc) bla;
+------+----------+
| c | max(val) |
+------+----------+
| a | 30 |
+------+----------+
1 row in set (0.01 sec)
mysql> select c, max(val) from (select * from demo order by c desc) bla;
+------+----------+
| c | max(val) |
+------+----------+
| c | 30 |
+------+----------+
1 row in set (0.01 sec)
Lach und weg...