SELECT convert(group_concat(id order by cnt desc),UNSIGNED) as id_max_cnt,
GROUP_CONCAT(category_prep.id) as cat_id,
GROUP_CONCAT((CONCAT ('<a href=\"search.php?page=1&city=1&preparate=тест&category=',id,'\">',Category ,' (',cnt,')','</a>')) ORDER BY `sort`) as category
FROM tbl