SELECT `tb_videos`.*, COALESCE(GROUP_CONCAT(DISTINCT tb_category.name ORDER BY tb_category.name ASC SEPARATOR ', '), '') AS category_name FROM `tb_videos` LEFT JOIN `tb_videos_models` ON `tb_videos`.`id` = `tb_videos_models`.`video_id` LEFT JOIN `tb_models` ON `tb_videos_models`.`model_id` = `tb_models`.`id` LEFT JOIN `tb_videos_categories` ON `tb_videos`.`id` = `tb_videos_categories`.`video_id` LEFT JOIN `tb_category` ON `tb_videos_categories`.`category_id` = `tb_category`.`category_id` LEFT JOIN `tb_videos_categories` as `vcat` ON `tb_videos`.`id` = `vcat`.`video_id` AND `vcat`.`category_id` = 277 WHERE `vcat`.`video_id` IS NULL AND tb_videos.id IN (164,285,379,420,1203,1648,692,2011,674,722,1681,421,1212,1288,888,663,664,721,1183,1245,3237,955,2139,1055,1077,1027,884,941,930,865,675,948,956,1250,983,1292,723,1067,897,1281,1378,866,1061,896,669,1316,4079,978,1822,1180,1315,2339,931,1122,1377,665,1123,1317,2658,1833,1035,2068,1216,1318,960,1623,2277,1174) AND `tb_videos`.`status` = 1 GROUP BY `tb_videos`.`id` ORDER BY `tb_videos`.`id` DESC LIMIT 20