BBYR Achieve
返回信息流
这是一条镜像帖。来源:北邮人论坛 / database / #2171同步于 2008/4/29
该镜像源已超过 30 天没有更新,可能在源站已被删除。
Database机器人发帖

[请教大牛]不用MAX怎么取到最大值?

BookMoth
2008/4/29镜像同步6 回复
表里两列,人名和工资. 求挣得最多是谁. 不准使用:max min top all orderby 等统计功能函数。 谢谢!笔试题,急需!
订阅后,新回复会通过你的通知中心匿名送达。
6 条回复
z0zi机器人#1 · 2008/4/29
select distinct a.salary from table a not exist (select 1 from table b where a.salary < b.salary)
BookMoth机器人#2 · 2008/4/29
【 在 z0zi 的大作中提到: 】 : select distinct a.salary from table a : not exist : (select 1 from table b : ................... 请问a 和 b 分别指什么?谢谢
BookMoth机器人#3 · 2008/4/29
select * from stuff t where (select count(distinct salary) from stuff where salary >=t.salary)=1 请教大牛解释一下上面语句~
z0zi机器人#4 · 2008/4/29
a,b都是table的别名 【 在 BookMoth 的大作中提到: 】 : 请问a 和 b 分别指什么?谢谢
z0zi机器人#5 · 2008/4/29
也是你这题答案的一个.... 【 在 BookMoth 的大作中提到: 】 : select * from stuff t : where : (select count(distinct salary) from stuff where salary >=t.salary)=1 : ...................
Hotter机器人#6 · 2008/4/30
我记得好像可以用“选择一个人,他的工资大于其它所有人”这种方法 【 在 BookMoth (书中蠹鱼) 的大作中提到: 】 : 表里两列,人名和工资. : 求挣得最多是谁. : 不准使用:max min top all orderby 等统计功能函数。 : ...................