Re: SQL statement question

From: MarkyG <markg_at_mymail.tm>
Date: Sat, 21 Jul 2001 21:55:33 GMT
Message-ID: <ab87195e.0106200046.1953b023_at_posting.google.com>


Hi,

When you say 'the first 50' i assume you are talking about the first 50 in some sort of order (like customer name), not just the first 50 from a table.

Solutions to this have been posted quite a few times on this newsgroups so i suggest using groups.google.com and doing an archive search ( i posted a reply to one or two, try searching on 'Rank' or 'Top N').

There is one solution, using an Order by in an inline view but depending on your Oracle version, it wont work. It works above Orace 8.??? (cant remember). Doesn't work for me and i'm using 8.1.7!

select ename, empno
FROM
   (select empno, ename
    from emp
    order by empno) e
WHERE
   rownum < 51;

Mark

"Nicholas Mudie" <nmudie_at_chello.com> wrote in message news:<JAIX6.100067$2f1.6172213_at_amsnews02.chello.com>...
> Hello,
>
> I want to return the first 50 rows of my sql statement results. How do I do
> this???
>
> I have hundreds of rows that are resturned in my CGI script but I only want
> 50 per page.
>
> Cheers,
> Nicholas Mudie
> CHELLO BROADBAND
Received on Sat Jul 21 2001 - 23:55:33 CEST

Original text of this message