Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: How do I use ROWNUM in a subquery (emulating SQL Server TOP n)
Sybrand,
If my question is so basic that I can just look it up in the
documentation. Howcome the Oracle Migration Workbench wasn't able to
migrate the query. It has migrated thousand of TOP N queries that
works, but this is in a different context which is more tricky, and
the usual way to solve TOP N does not work.
I bet you can't solv it either, reading the documentation or not...
Best regards
/Gosta
Sybrand Bakker <sybrandb_at_hccnet.nl> wrote in message news:<8hseq0h2gjjhqj1rmld5rfqmhq25cn3bit_at_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.
Received on Mon Nov 29 2004 - 05:24:26 CST
![]() |
![]() |