【发布时间】:2014-05-28 07:54:11
【问题描述】:
我有一个名为Products 的表,其中有一列Prices。
如何从该表中获得第 5 个最大值?
我找到了两种方法:
=1=
select max(id)
from EMP A
where 5=( select count(distinct(id))
From EMP B
where B.ID>=A.ID )
=2=
SELECT *
FROM Products Price1
WHERE (4) = (SELECT COUNT(DISTINCT(Price2.Price))
FROM products Price2
WHERE Price2.Price > Price1.Price)
【问题讨论】:
-
这是 mysql 还是 SQL server?为什么你同时标记了两者?两者的答案是不同的。
-
我想删除这个问题。有可能吗?
标签: sql