D.B. Error :
خطأ في تنفيذ الاستعلام (17).

(3029)Expression #2 of ORDER BY contains aggregate function and applies to the result of a non-aggregated querySELECT iGID,iTitle,iPhotoEx FROM `images` WHERE iGID=(select images.iGID from images,imagescategories where images.iDate >= (SELECT iDate FROM images WHERE iGID = 7082) and images.iGID<>7082 and images.iActive<>0 and images.iDeleted<>1 AND imagescategories.icDetermineAge=0 order by iDate DESC,max( iRating / iRatingCount ) LIMIT 1) LIMIT 1Expression #2 of ORDER BY contains aggregate function and applies to the result of a non-aggregated query