找到表中最高的薪水 [英] finding the highest salary in a table

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

问题描述

 选择 * 来自 emp m  where  select  COUNT( distinct 薪水) from  emp s 其中​​ s.salary> m.salary)= 0 









任何人都可以告诉我执行流程是什么



代码块已修复[/ edit]

解决方案

在SQL Server Management Studio中,您可以显示执行计划。单击Ctrl + M,或从菜单中选择查询|包括实际执行计划。



这将根据您的表结构(可用的索引),您的表内容(统计数据),服务器硬件(RAM,CPU数量)和您的服务器负载(如果有更多资源可用,服务器将投入更多资源来构建计划)。



所以唯一可以告诉您执行计划是什么的人。



祝你好运,

Pablo。


我认为你可以使用MAX功能.. 。



例如:

从table_name中选择MAX(coloumn_name);



谢谢。


您可以像Maxun先生所说的那样使用Max查询这个查询,

  select  * 来自 \\ temp 其中​​ salary =(选择最大(工资)来自 emp)





这将给你一份薪水最高的员工名单。



我希望这会有效。

谢谢: )


select * from emp m where(select COUNT(distinct salary) from emp s where s.salary>m.salary)=0





can any one tell me what is the execution flow

[edit]code block fixed[/edit]

解决方案

In SQL Server Management Studio, you can show the execution plan. Click Ctrl+M, or from the menu, choose ''Query|Include Actual Execution Plan''.

This will vary depending on your table structure (which indexes are available), your table contents (statistics), your server hardware (RAM, number of CPUs), and your server load (the server will invest more resources building a plan if more resources are available).

So the only one who can tell what is the execution plan is you.

Good luck,
Pablo.


I think that you can use MAX function...

For Example:
Select MAX(coloumn_name) from table_name;

Thanks.


You can use this query with Max function like Mr. Tarun said,

select * from emp where salary = (select Max(salary) from emp)



This is will give you a list of employees who have highest salary.

I hope this will work.
Thanks :)


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

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