Re: SQL*PLUS CHALLANGE

From: Michael Serbanescu <ms_at_cmprime.cis.att.com>
Date: 1996/09/27
Message-ID: <324BE38F.1D1F_at_cmprime.cis.att.com>#1/1


Try this:

select distinct name, address
from emp
where city='LA'
and rownum<26;

I haven't tried it, so I am not sure it will work. The DISTINCT clause (?) does an implicit ordering (although, I believe, this is not guaranteed by the SQL standard).

Michael Serbanescu
Sr. ORACLE DBA, TRECOM Business Systems, Edison, NJ ms_at_cmprime.cis.att.com



Roya Mehrfar wrote:
>
> I have a sqlplus statement with an order by that I need to retrieve only
> the first 25 rows. I tried where rownum < 26 but it trows away my order
> by because I would like to do the order by first and then get the first
> 25 rows.My statement looks like:
>
> select name, address
> from emp
> where city='LA'
> order by name;
>
> If I add rownum<26 it gets the first 25 and then orders by name, but I
> want to order by first.
>
> I thought of maybe adding 'minus' clause, but that didn't work either.
>
> Thanks for any help
Received on Fri Sep 27 1996 - 00:00:00 CEST

Original text of this message