
09/10/2008, 10:59
|
Colaborador | | Fecha de Ingreso: marzo-2008 Ubicación: Cáceres
Mensajes: 3.735
Antigüedad: 17 años Puntos: 300 | |
Respuesta: recojer datos de la ultima fecha Mediante dos consultas, como pedías:
Este para el más reciente
SELECT t.id, t.imagen, t.fecha FROM tabla t INNER JOIN (SELECT fecha FROM tabla GROUP BY fecha ORDER BY fecha DESC LIMIT 0,1)t1 ON t1.fecha = t.fecha
y este para el siguiente
SELECT t.id, t.imagen, t.fecha FROM tabla t INNER JOIN (SELECT fecha FROM tabla GROUP BY fecha ORDER BY fecha DESC LIMIT 1,1)t1 ON t1.fecha = t.fecha
puedes añadir un ORDER BY al final de cada una de las consultas para ordenarlas por otro criterio, además del de la fecha. |