Click here to Skip to main content
15,895,709 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I Was a Table In Table There Is 2 Column 1 is EmpAdmin and 2 is Emp . Employee is Working Under EmPAdmin is Want to Find Out The EMPAdmin Whose Under Maximum No of EMPloyee Work
Posted

 
Share this answer
 
Try this, Hope this will help you.

SQL
declare @t table(aid int, eid int)

insert @t values(1,1)
insert @t values(1,1)
insert @t values(1,1)
insert @t values(1,1)
insert @t values(2,1)
insert @t values(2,1)


select top 1 aid,e from (
select aid,count(eid) e from @t
group by aid) p
order by e desc
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900