select manager_code, count(distinct fund_code) as c from xxx group by manager_code having c>2 order by c desc;
django orm:
s = fd.objects.values('manager_code').annotate(fund_count=Count('fund_code, distinct=True)).filter(fund_count__gt=2).order_by('-fund_count')