Загрузка данных


select
    c.agent_id_1c,
    count(*) as cnt
from ourpension.contract c
where c.service_type in ('NPO', 'PDS')
  and c.agent_id_1c is not null
group by c.agent_id_1c
order by cnt desc
limit 20;