Below is mysql query
SELECT s_search_pattern,category_id FROM oc_t_as_eseo_search_patterns WHERE b_active = 1 ORDER BY i_num_items DESC GROUP BY s_search_