Mysql
 sql >> Database >  >> RDS >> Mysql

Recupero dell'ultima nota (per timestamp) in una singola query da una tabella 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)