$last_add = mysql_query ("SELECT jb_board.id AS board_id, jb_board.id_category, jb_board.title, jb_board.city, DATE_FORMAT(jb_board.date_add,'%d.%m.%Y') AS dateAdd, jb_board.checkbox_top, jb_board.checkbox_select, jb_board_cat.id, jb_board_cat.".$name_cat.", jb_photo.photo_name, jb_city.city_name, jb_city.en_city_name FROM jb_board LEFT JOIN jb_board_cat ON jb_board.id_category = jb_board_cat.id LEFT JOIN jb_city ON jb_board.city_id = jb_city.id LEFT JOIN jb_photo ON jb_board.id = jb_photo.id_message WHERE jb_board.old_mess = 'old' AND jb_board_cat.id='".$_GET['id_cat']."' ".$subQuery." GROUP by board_id ORDER BY jb_board.checkbox_top DESC, jb_board.top_time DESC, jb_board.id DESC LIMIT ".$start.", ".$c['count_adv_on_index']);cq();