185. Department Top Three Salaries
问题描述

解决方案
select b.name Department,a.name Employee,a.salary Salary
from Employee a,Department b
where a.departmentid=b.id and
(select count(distinct salary)
from Employee
where departmentid=a.departmentid and salary>a.salary
)<3
order by departmentid asc,salary desc ;
参考资料
- sql取出每个分组的前几条 http://blog.csdn.net/zhichao2001/article/details/6068893
185. Department Top Three Salaries的更多相关文章
- LeetCode - 185. Department Top Three Salaries
The Employee table holds all employees. Every employee has an Id, and there is also a column for the ...
- 【SQL】185. Department Top Three Salaries
The Employee table holds all employees. Every employee has an Id, and there is also a column for the ...
- [LeetCode] Department Top Three Salaries 系里前三高薪水
The Employee table holds all employees. Every employee has an Id, and there is also a column for the ...
- [SQL]LeetCode185. 部门工资前三高的员工 | Department Top Three Salaries
SQL 架构 Create table If Not Exists Employee (Id ), Salary int, DepartmentId int) Create table If Not ...
- LeetCode——Department Top Three Salaries(巧妙使用子查询)
The Employee table holds all employees. Every employee has an Id, and there is also a column for the ...
- 【leetcode】Department Top Three Salaries
The Employee table holds all employees. Every employee has an Id, and there is also a column for the ...
- leetcode185 Department Top Three Salaries
Employee表存储员工姓名.员工所在公寓.员工工资 Department表存储公寓id 评选出各个公寓的工资前三名的员工. 遇到的问题如下: limit,in等语句不能用在嵌套select语句中, ...
- [LeetCode]-DataBase-Department Top Three Salaries
The Employee table holds all employees. Every employee has an Id, and there is also a column for the ...
- LeetCode All in One 题目讲解汇总(持续更新中...)
终于将LeetCode的免费题刷完了,真是漫长的第一遍啊,估计很多题都忘的差不多了,这次开个题目汇总贴,并附上每道题目的解题连接,方便之后查阅吧~ 477 Total Hamming Distance ...
随机推荐
- python作用域和JavaScript作用域
JavaScript 一.JavaScript中无块级作用域 一个大括号一个作用域,就属于块级作用域,在Java和c#才存在块级作用域 function Main(){ if(1==1){ var n ...
- 我的Android进阶之旅------>Android中通过adb shell input来模拟滑动、按键、点击事件
今天在维护公司的一个小项目的时候,发现按公司手机的某个物理按键,激活相应的Service后,会在屏幕上模拟的点击了屏幕的某个坐标点.好家伙,原来是之前该项目的版本是按这个物理按键后,会弹出一个对话框, ...
- 001infor record 计划时间取值增强-20150622
ZMD_MRP_PARAMETERS 3000公司下工厂跑MRP时,如果为外购则通过外挂表取infor record计划交期. METHOD if_ex_md_mrp_parameters~adjus ...
- php 数组 高效随机抽取指定条记录的算法
php使用数组array_rand()函数进行高效随机抽取指定条数的记录,可以随机抽取数据库中的记录,适合进行随机展示和抽奖程序. 该算法主要是利用php的array_rand()函数,下面看一下ar ...
- Java FAQ -- "Exception in thread 'main' java.lang.UnsupportedClassVersionError:"
OS:Ubuntu 最近重新学习Java,写了一段很小的程序,如下: public class Hello{ public static void main(String args[]){ Syste ...
- linux shell 入门
本文是本人学习linux shell入门收集整理,不完全原创. 参考博文: http://www.cnblogs.com/suyang/archive/2008/05/18/1201990.html ...
- Pro*C基础
SQL变量的申明: EXEC SQL BEGIN DECLARE SECTION; 类型 变量名[长度] varchar2 serv_number[]; 其中可以定义C变量 EXEC SQL END ...
- RocketMq入坑指南
报错信息Caused by: org.apache.rocketmq.remoting.exception.RemotingConnectException: connect to <172.1 ...
- 主攻ASP.NET MVC4.0之重生:MVC Controller修改Controller.tt模版,自动添加版本注释信息
第一步找到MVC 4.0 CodeTemplates 一般路径在:C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Ite ...
- Java Map增删改查
示例代码: 学生类 package com.imooc.collection; import java.util.HashSet; import java.util.Set; /** * 学生类 * ...