Skip site navigation (1) Skip section navigation (2)

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: (view raw, whole thread or download thread mbox)
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


In response to

pgsql-novice by date

Next:From: Philip HallstromDate: 2002-10-18 23:50:22
Subject: Re: Random tuple?
Previous:From: Brendan LeFebvreDate: 2002-10-18 23:09:52
Subject: Random tuple?

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group