...工资最高的前三条信息按升序排在最前面,其余的按原序
发布网友
发布时间:2024-10-14 01:07
我来回答
共3个回答
热心网友
时间:2024-10-14 04:08
请说明使用的数据库类型
mysql如下
select distinct * from(
select * from WorersSalary orde by Salary desc limit 0,3 a union
select * from WorersSalary b)
sqlserver如下
select distinct * from(
select top 3 * from WorersSalary orde by Salary desc a union
select * from WorersSalary b)
热心网友
时间:2024-10-14 04:04
select tt.salary from
(select t.salary,row_number() over (order by salary) from WorersSalary t
) tt
where tt.rn<=3
union
select salary from WorersSalary
union会合并结果集,并排除掉重复记录,所以不敢保证这个查询能满足你要求,最好配合人员的ID去做
热心网友
时间:2024-10-14 04:10
ujuyj