title: How to get a list (of IDs) of grouped records using Rails+MySQL?
body: <p>I can group records with the count of grouped records like this:</p>
  
  <pre><code>@cars = Car.group(:manufacturer).select("id, manufacturer, COUNT(id) AS total_count)
  </code></pre>
  
  <p>And the output will be something like this;</p>
  
  <pre><code>Porsche - 5
  Renault - 3
  Mercedes - 1
  Audi - 2
  </code></pre>
  
  <p>I am trying to figure out now how to also get a list of the grouped records (their IDs) - like for Porsche, I would like to know the 5 grouped cars (their IDs). Is there any way to do it - ideally with using MySQL (in the <code>select</code> passage)?</p>