profile_id company_name 1 Tcs 2 cts 3 hcl 1 hexa 4 mindtree 3 cts 1 cts
profile-id company_count 1 3
select u.name,Count(distinct ex.company_name) from user u inner join role r on (r.id = u.role_id) inner join experience ex on (ex.profile_id = u.profile_id) where r.name ="Alumni" group by u.name --having Count(distinct ex.company_name) in (select max(ex.company_name) from experience ex where ex.profile_id = u.profile_id) order by u.name
SELECT TOP 1 profile_id,COUNT(company_name) company_count FROM COMPANY GROUP BY profile_id ORDER BY MAX(company_name) DESC
select u.name,Count(distinct ex.company_name) from [user] u inner join role r on (r.id = u.role_id) inner join experience ex on (ex.profile_id = u.profile_id) where r.name ="Alumni" group by u.name --having Count(distinct ex.company_name) in (select max(ex.company_name) from experience ex where ex.profile_id = u.profile_id) order by u.name
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)