Oracle DB中TOP WITH TIES的正确SQL语法是什么?

时间:2016-02-02 20:48:51

标签: sql oracle

Oracle不允许使用TOP WITH TIES,所以我想知道如何使用TOP WITH TIES来符合Oracle DB标准?谢谢。

enter image description here

1 个答案:

答案 0 :(得分:3)

Oracle v12.1 +有自己的行限制功能:

SELECT
    S.EmpID,
    S.Ename,
    ...
FROM
    SalesPersons S
LEFT JOIN ...
GROUP BY ...
ORDER BY ...
FETCH FIRST 1 ROW WITH TIES