Received: from smtp013.mail.yahoo.com (smtp013.mail.yahoo.com [216.136.173.57]) by postgresql.org (8.11.3/8.11.1) with SMTP id f6ADOxa79352 for ; Tue, 10 Jul 2001 09:24:59 -0400 (EDT) (envelope-from janwieck@yahoo.com) Received: from jupiter.us.greatbridge.com (65.196.69.55) by smtp.mail.vip.sc5.yahoo.com with SMTP; 10 Jul 2001 13:24:55 -0000 X-Apparently-From: Received: (from wieck@localhost) by jupiter.us.greatbridge.com (8.11.2/8.11.2) id f6ADVk914719; Tue, 10 Jul 2001 09:31:46 -0400 From: Jan Wieck Message-Id: <200107101331.f6ADVk914719@jupiter.us.greatbridge.com> Subject: Re: select only the first record In-Reply-To: from "juerg.rietmann@pup.ch" at "Jul 10, 2001 03:09:18 pm" To: juerg.rietmann@pup.ch Date: Tue, 10 Jul 2001 09:31:46 -0400 (EDT) CC: pgsql-sql@postgresql.org X-Mailer: ELM [version 2.4ME+ PL68 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Archive-Number: 200107/103 X-Sequence-Number: 3887 juerg.rietmann@pup.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@Yahoo.com # _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com