i have a table that contains a list of images and would like to sort them to a popular image sequence. Below listed the table and i would like to make the "Target column", in order for me to sort popular image.
Here is the SQL code:
SELECT imageID FROM `ratings` WHERE rating > 3 ORDER BY imageID DESC
Thanks for your help.
Try this, use a count and a group by, this will count repeated ImageID:
SELECT count(*) as ct, imageID
FROM `ratings`
WHERE rating > 3
GROUP BY imageID
ORDER BY ct