Hola RIVERMILLOS:
Me imagino que tu campo fecha es de tipo detetime, así es que creo que puedes hacer lo siguiente:
Código MySQL:
Ver originalQuery OK, 0 rows affected (0.09 sec)
-> (1,1, 'detalle 1', '2011-06-28 13:51:00'),
-> (2,1, 'detalle 2', '2011-06-28 14:15:00'),
-> (3,1, 'detalle 3', '2011-06-28 16:59:00'),
-> (4,1, 'detalle 4', '2011-06-27 09:22:00'),
-> (5,1, 'detalle 5', '2011-06-27 11:27:00'),
-> (6,1, 'detalle 6', '2011-06-27 12:08:00');
Query OK, 6 rows affected (0.05 sec)
+-------------+----------+-----------+---------------------+
| idhistorico | idaccion | detalles | fecha |
+-------------+----------+-----------+---------------------+
| 1 | 1 | detalle 1 | 2011-06-28 13:51:00 |
| 2 | 1 | detalle 2 | 2011-06-28 14:15:00 |
| 3 | 1 | detalle 3 | 2011-06-28 16:59:00 |
| 4 | 1 | detalle 4 | 2011-06-27 09:22:00 |
| 5 | 1 | detalle 5 | 2011-06-27 11:27:00 |
| 6 | 1 | detalle 6 | 2011-06-27 12:08:00 |
+-------------+----------+-----------+---------------------+
-> on H1.fecha
= H2.max_fecha
; +-------------+----------+-----------+---------------------+
| idhistorico | idaccion | detalles | fecha |
+-------------+----------+-----------+---------------------+
| 3 | 1 | detalle 3 | 2011-06-28 16:59:00 |
| 6 | 1 | detalle 6 | 2011-06-27 12:08:00 |
+-------------+----------+-----------+---------------------+
Haz la prueba y nos comentas.
Saludos
Leo.