首页 > 解决方案 > 如何从两个表中获得最高工资

问题描述

我有两张表,我想从中获得最高薪水员工姓名。这是表 1st 是emp_info & 2nd 是emp_salary第一表 第二表

我需要的输出是...

电子名 | e_salary

美国广播公司 | 35000

标签: mysql

解决方案


您可以使用子查询在下面尝试

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) 

推荐阅读