Expression #4 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.title,a.amount,img.aid AS img_aid,img.ext AS img_ext, img.upload_datetime AS img_upload_datetime FROM album_albums AS a LEFT JOIN album_inalbum AS i ON = i.album_id LEFT JOIN album_images AS img ON i.image_id = WHERE a.userid = 2 AND != 18515 GROUP BY ORDER BY DESC LIMIT 0, 6