Re: Simple SQL question.

From: Graeme Sargent <graeme_at_pyra.co.uk>
Date: Mon, 5 Jul 1993 10:46:09 GMT
Message-ID: <1993Jul5.104609.6048_at_pyra.co.uk>


In <2JUL199316494641_at_author.gsfc.nasa.gov> chamblej_at_author.gsfc.nasa.gov (JEFF CHAMBLEE (512)) writes:

>In article <211j9t$7rt_at_oac4.hsc.uth.tmc.edu>, Shirley <shirley_at_odin.mda.uth.tmc.edu> writes...
>>My question is atually an extension of Chris G. vanHasselt's question.
>>Is it possible to write a SQL query so that instead of returning all
>>records satisfying a where clause, it returns rows between n1... n2
>>where n1 = 10 and n2 = 20.
 

>The following is grossly inefficient but is nice for small tables

					     ^^^^
					You're joking!

>SELECT * FROM TABLE WHERE ROWNUM <= 20
>MINUS
>SELECT * FROM TABLE WHERE ROWNUM < 10

If you really *must* do this it would surely be better to use:

    SELECT * FROM TABLE WHERE ROWNUM BETWEEN 10 AND 20 but as David TvE points out, if you feel a need to do it, it means you're doing *something* WRONG!

graeme

--
Disclaimer:	The author's opinions are his own, and not necessarily
		those of Pyramid Technology Ltd. or Pyramid Technology Inc.
---------------------------------------------------------------------------
      -m------- Graeme Sargent                 Voice: +44 (0)252 373035
    ---mmm----- Senior Database Consultant     Fax  : +44 (0)252 373135
  -----mmmmm--- Pyramid Technology Ltd.        Telex: Tell who???
-------mmmmmmm- Farnborough, Hants  GU14 7PL   Email: graeme_at_pyra.co.uk
---------------------------------------------------------------------------
    We have the technology.  The tricky bit is learning how to use it.
Received on Mon Jul 05 1993 - 12:46:09 CEST

Original text of this message