Ver Mensaje Individual
  #4 (permalink)  
Antiguo 16/09/2011, 11:07
jurena
Colaborador
 
Fecha de Ingreso: marzo-2008
Ubicación: Cáceres
Mensajes: 3.735
Antigüedad: 16 años
Puntos: 300
Respuesta: Obtener último elemento de un GROUP BY

Pinchu,
prueba esto y nos dices:
SELECT t1.id_mensaje, t1.contenido, t1.id_grupo, t1.fecha FROM (SELECT id_mensaje, contenido, id_grupo, fecha FROM `tabla` ORDER BY id_grupo, fecha DESC)t1 group by t1.id_grupo

Última edición por jurena; 17/09/2011 a las 14:16