select s.svc_id s.svc s.svc_short s.orchestrator_name s.code s.is_production_ready s.descr s.version s.sort (select count(*) from specification_item i where i.svc_id=s.svc_id) as spec_cnt from svc s where 1=1 order by select count(*) as cnt from svc where 1=1 Сервисы title="редактировать" class="edit"title="просмотр" class="view"> #svc# #gridFooter#