There was an SQL error: Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'londonartstudies.favourites.added_at' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by - SELECT `videos`.* FROM (`videos`) JOIN `favourites` ON (`favourites`.`video_id` = `videos`.`id`) WHERE `is_visible` = 1 AND `videos`.`id` IN ('',4,71,56,83,34,38,11,87,21) GROUP BY `videos`.`id` ORDER BY `favourites`.`added_at` DESC