Fixed sql for retrieving most popular images by desc. order