title: Query which group data with same values in the last X days
body: <p>I would like to get a list of the 5 most used <code>model_id</code> from my table in the last 14 days. The problem is that I can't find a way to group <code>model_id</code> to avoid having the same <code>model_id</code> multiple time in the result.</p>
  
  <p><strong>media table</strong></p>
  
  <pre><code>+----+-------+----------+---------------------+
  | id | title | model_id |        date         |
  +----+-------+----------+---------------------+
  |  1 |   ... |        1 | 2017-10-04 01:47:46 |
  |  2 |   ... |        1 | 2017-10-03 02:47:46 |
  |  3 |   ... |        2 | 2017-10-02 03:47:46 |
  |  4 |   ... |        2 | 2017-10-02 02:47:46 |
  |  5 |   ... |        3 | 2017-10-01 04:47:46 |
  +----+-------+----------+---------------------+
  </code></pre>
  
  <p>this is my code so far (which is not working)</p>
  
  <pre><code>SELECT COUNT(medias.model_id), medias.date
  FROM medias
  GROUP BY medias.model_id HAVING COUNT(medias.model_id) &gt; 1
  WHERE date &gt; DATE_SUB(CURDATE(), INTERVAL 14 DAY)
  </code></pre>