Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: How do I use ROWNUM in a subquery (emulating SQL Server TOP n)

Re: How do I use ROWNUM in a subquery (emulating SQL Server TOP n)

From: Sybrand Bakker <sybrandb_at_hccnet.nl>
Date: Fri, 26 Nov 2004 19:13:31 +0100
Message-ID: <8hseq0h2gjjhqj1rmld5rfqmhq25cn3bit@4ax.com>


On 26 Nov 2004 02:04:03 -0800, gosta_at_midworldproduction.com (Gosta Hulden) wrote:

>As most of you might now, the common way of emulating SQL Servers TOP
>n is to use ROWNUM
>SELECT TOP 1 fld1 FROM tbl ORDERBY fld1;
>becomes
>SELECT * FROM (SELECT fld1 FROM tbl ORDER BY fld1) WHERE ROWNUM <= 1;
>
>BUT, how can I do it in a sub query?

TOP N can be looked up in the Oracle documentation. Please avoid asking mere doc questions here.

--
Sybrand Bakker, Senior Oracle DBA
Received on Fri Nov 26 2004 - 12:13:31 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US