Path: utzoo!attcan!uunet!ns-mx!vaxa.weeg.uiowa.edu!broy From: broy@vaxa.weeg.uiowa.edu (Barbara Roy) Newsgroups: comp.databases Subject: Re: SELECT only x number of items Keywords: SELECT SQL Message-ID: <2796@ns-mx.uiowa.edu> Date: 18 Oct 90 15:45:43 GMT References: <5@unigold.UUCP> Sender: news@ns-mx.uiowa.edu Reply-To: broy@vaxa.weeg.uiowa.edu Organization: U of I - Weeg Computing Center Lines: 18 News-Software: VAX/VMS VNEWS 1.3-4 In article <5@unigold.UUCP>, lance@unigold.UUCP (Lance Ellinghouse) writes... >Is there a way to say 'I want to select only the first 5 items >that full-fill my criteria?' without using ESQLC? I would like >to really do it using straight SQL (BTW: I am using Ingres and >Ingres specific ways are fine also). Not being familiar with Ingres I can only vouch for what would work in Oracle SQL. Perhaps Ingres can use the ROWNUM pseudo-column that Oracle uses? Select * from table_name where rownum < 6; Note that rownum is assigned before the rows are ordered by any ORDER BY clause. Barbara Roy, Weeg Computing Center, University of Iowa, Iowa City, IA. 52242 Phone: 319-335-5506 Internet: broy@vaxa.weeg.uiowa.edu Bitnet: broyva@uiamvs Disclaimer: My opinions are solely my own and may change daily.