title: Select top 10 posts ordered by quantity of votes
body: <p>I have two tables, one for image records (posts) and the other one is for likes records. So i made an INNER JOIN from one table to another because i needed to select the image and the quantity of likes that particular image has. but i also need to order them by the quantity of likes so i can make a top 10 of most voted images on the site, so here is my query:</p>
  
  <pre><code>SELECT
    COUNT(DISTINCT B.votes),
    A.id_image,
    A.image,
    A.title
  FROM likes_images AS B INNER JOIN images AS A ON A.id_image = B.id_image
  GROUP BY A.title
  ORDER BY COUNT(DISTINCT B.votes) ASC
  LIMIT 10
  </code></pre>
  
  <p>It works, but it's only ordering the images by the title (Alphabetical). I want to order them from the most voted to the less voted.</p>
  
  <p>Any ideas?</p>