sql >> Base de Datos >  >> RDS >> Mysql

Grupo MySQL por última entrada

Pruebe esta consulta -

SELECT t1.* FROM payment_status t1
  JOIN (SELECT payment_id, MAX(created) max_created
        FROM payment_status
        GROUP BY payment_id
        ) t2
    ON t1.payment_id = t2.payment_id AND t1.created = t2.max_created;

... luego agregue DONDE las condiciones que necesita.