Re: select only the first record

From: Jan Wieck <JanWieck(at)Yahoo(dot)com>
To: juerg(dot)rietmann(at)pup(dot)ch
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: select only the first record
Date: 2001-07-10 13:31:46
Message-ID: 200107101331.f6ADVk914719@jupiter.us.greatbridge.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

juerg(dot)rietmann(at)pup(dot)ch wrote:
> Hello there
>
> Is it possible to do a query and selecting only the first record in ad
> table ?
>
> e.g. select FIRST * from cars

You can either use a CURSOR and FETCH only the first row, or
use LIMIT (non-standard).

And you might want to explicitly ORDER the result set,
otherwise exchange "FIRST" with "ONE-RANDOM" in your
question.

Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================== JanWieck(at)Yahoo(dot)com #

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Christof Glaser 2001-07-10 13:38:55 Re: select only the first record
Previous Message juerg.rietmann 2001-07-10 13:09:18 select only the first record