All pastes #86781 Raw Edit

Untitled

public text v1 · immutable
·published 2006-07-13 06:36 UTC
rendered paste body
mysql> select * from foo;
+----+-------+------+---------------------+
| id | catid | name | ts                  |
+----+-------+------+---------------------+
|  1 |     1 | cat1 | 2006-07-06 08:51:29 |
|  2 |     1 | cat1 | 2006-07-07 08:51:42 |
|  3 |     1 | cat1 | 2006-07-08 08:51:44 |
|  4 |     1 | cat1 | 2006-07-09 08:51:52 |
|  5 |     1 | cat1 | 2006-07-10 08:52:07 |
|  6 |     1 | cat1 | 2006-07-11 08:52:13 |
|  7 |     1 | cat1 | 2006-07-12 08:52:16 |
|  8 |     2 | cat2 | 2006-07-06 08:53:10 |
|  9 |     2 | cat2 | 2006-07-07 08:53:10 |
| 10 |     2 | cat2 | 2006-07-08 08:53:10 |
+----+-------+------+---------------------+
10 rows in set (0.01 sec)
mysql> select catid,name,ts from foo order by max(ts);
+-------+------+---------------------+
| catid | name | ts                  |
+-------+------+---------------------+
|     1 | cat1 | 2006-07-06 08:51:29 |
+-------+------+---------------------+
1 row in set (0.00 sec)