title: MySQL get latest 3 rows for every id in where in
body: <p>I'm having the following query, which supposedly will get the latest 3 comments for every update_id. It seemingly works until I discovered a logical issue where it gets the latest 3 comments regardless the update; it is supposed to get the latest 3 comments for every update_id. How can I achieve this? Obviously the limit(3) is wrong. </p>
  
  <pre><code>SELECT  `comms` . * ,  `usr`.`name` 
  FROM (
  `comms`
  )
  JOIN  `users` AS usr ON  `usr`.`id` =  `comms`.`user_id` 
  WHERE  `update_id` 
  IN (
  '1451',  '1416',  '1186',  '1157',  '1150',  '1122',  '1057',  '914',  '850',  '816',  '794',  '790',  '749',  '746',  '745',  '744',  '740'
  )
  ORDER BY  `id` DESC 
  LIMIT 3
  </code></pre>