Expression #5 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'imx365.img.aid' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by SELECT a.id,a.userid,a.title,a.amount,img.aid AS img_aid,img.upload_datetime AS img_upload_datetime,img.ext AS ext FROM album_albums AS a LEFT JOIN album_inalbum AS i ON a.id = i.album_id LEFT JOIN album_images AS img ON i.image_id = img.id WHERE a.userid = 4983 GROUP BY a.id ORDER BY a.id DESC