Re: Selecting only the first row from a query

From: John D. White <jdwhite_at_katie.vnet.net>
Date: 1995/11/30
Message-ID: <49keg8$jtu_at_ralph.vnet.net>#1/1


Joel Nylund (joel_nylund_at_mail.amsinc.com) wrote:

: I need to write a sql statement to only return the first row that meets
: the criteria. For example I have a table called people with names and
: phone numbers. There may be several "Joel Nylund's" in the table, I only
: want the first one I find.
 

: in DB2, I can do a select first
 

: I am looking for something that will work in oracle and sybase.
 

: thanks in advance
: Joel

There is a pseudocolumn ROWNUM that you can use.

and rownum = 1
Hope this helps
Good Luck!

--
John D.(JD) White Oracle Client/Server Consultant Inventor of the ATM
Whiteline Design, Inc. 7812 Blackwing Ct.Raleigh, NC  27615  USA
Received on Thu Nov 30 1995 - 00:00:00 CET

Original text of this message