mysql - 如何从两个表中获得最高工资
问题描述
我有两张表,我想从中获得最高薪水和员工姓名。这是表 1st 是emp_info & 2nd 是emp_salary。 第一表 第二表
我需要的输出是...
电子名 | e_salary
美国广播公司 | 35000
解决方案
您可以使用子查询在下面尝试
select e_name,e_salary from emp_info a
inner join emp_salary b on a.emp_id=b.emp_id
where e_salary in (select max(e_salary) from emp_salary)
推荐阅读
- javascript - 在 NavLink 中活动时如何更改图标图像?
- r - 将基于序列和值的数值变量扩展到多列
- sql - SQL 中的 OR 和 AND 返回不应出现的结果
- html - 当表单命名为标题时,表单输入字段不起作用
- javascript - 当我使用 Material UI CSS 语法将鼠标悬停在菜单项中的子组件上时,如何使删除图标出现?
- java - Thymeleaf/Spring 在表单中输入日期时抛出错误
- vb.net - 使用 Visual Studio 在编译时包含源文件
- mysql - 我正在创建一个反应聊天应用程序,我想知道在发送消息时如何获取新消息
- arrays - 在 Pgx 中运行 SELECT * FROM 表查询?
- c# - 在 iOS 和 ArcGIS Runtime 上使用热重启 Xamarin 表单导致应用程序崩溃