Re: Random tuple?

From: Jon Jensen <jon(at)endpoint(dot)com>
To: Brendan LeFebvre <brendanl(at)iname(dot)com>
Cc: "Pgsql-Novice(at)Postgresql(dot) Org" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Random tuple?
Date: 2002-10-18 23:13:11
Message-ID: Pine.LNX.4.44.0210182312410.1312-100000@louche.swelter.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Fri, 18 Oct 2002, Brendan LeFebvre wrote:

> Is there available a routine, intrinsic or otherwise, that allows for simple
> extraction of one(1) random tuple from a given table or query-result?

How about:

SELECT * FROM your_table ORDER BY random() LIMIT 1

Jon

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Philip Hallstrom 2002-10-18 23:50:22 Re: Random tuple?
Previous Message Brendan LeFebvre 2002-10-18 23:09:52 Random tuple?