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

Recuperar la última nota (por marca de tiempo) en una sola consulta de una tabla 1:n

 select users.name, notes.subject, notes.heading, notes.body
 from users, notes
 where users.id = notes.user_id
 and notes.timestamp = (select max(timestamp) from notes where user_id = users.id)