在inGiven表中找到最大值 [英] Find Max Value inGiven Table

查看:79
本文介绍了在inGiven表中找到最大值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是表中的表有2列1是EmpAdmin,2是Emp。员工在EmPAdmin下工作想要找出EMPAdmin最大的EMPAdmin工作

解决方案

SQL - 显示最大计数的条目? [ ^ ]


试试这个,希望这会对你有帮助。



 声明  @ t   table (aid  int ,eid  int 

insert @ t 1 1
插入 @ t 1 1
insert @ t 1 1
insert @ t 1 1
insert @ t values 2 1
insert @t 2 1


选择 top 1 援助,e 来自
选择援助,计算(eid)e 来自 @ t
group by aid) p
订单 e desc


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

解决方案

SQL - Displaying entries that are the max of a count?[^]


Try this, Hope this will help you.

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


这篇关于在inGiven表中找到最大值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆