在Oracle中替代SQL Server TOP [英] Alternate of sql server TOP in oracle
本文介绍了在Oracle中替代SQL Server TOP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在oracle pl sql中获取前3条记录?我是oracle的新手,以前我使用过sql server.
How to get top 3 records in oracle pl sql?i am new to oracle,earlier i have used sql server.
我的要求是获取第X列的前3条记录.
My requirement is to get distinct top 3 records of Column X.
推荐答案
尝试使用此方法从查询中检索前N条记录,可以使用以下语法::-
Try this to retrieve the Top N records from a query, you can use the following syntax::-
SELECT *
FROM (your ordered query) alias_name
WHERE rownum <= Rows_to_return
示例:-
SELECT *
FROM (select * from suppliers ORDER BY supplier_name) suppliers2
WHERE rownum <= 3
这篇关于在Oracle中替代SQL Server TOP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文