Re: Simple SQL question.

From: Henri Schueler <jhs_at_ipsa.reuter.com>
Date: Wed, 30 Jun 1993 03:13:22 GMT
Message-ID: <C9EzMC.FJ3_at_ipsa.reuter.com>


In article <1993Jun28.160553.18327_at_sequent.com> ejg_at_sequent.com (Evan J. Greene) writes:
>In article <20mvj6$hi_at_samba.oit.unc.edu> chrisvh_at_med.unc.edu (Chris G. vanHasselt) writes:
>>My question has either a real simple solution or it can't be done! Is
>>there a way, without creating some sort of dummy field, to write a SQL
>>query so that instead of returning all records satisfying a where clause,
>>it returns only the first 5 records satisfying that clause.
>>
>Yes, there is a way: add "AND ROWNUM <= 5" to your WHERE clause...

But remember that since sql tables are unordered sets, that using the ROWNUM clause without an ORDER BY clause means that you will get *any* 5. *First* 5 is a void concept.
/jhs

-- 
J. Henri Schueler, H&h Software, Toronto	+1 416 698 9075 
Received on Wed Jun 30 1993 - 05:13:22 CEST

Original text of this message