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

select 2 random rows

From: Rory Campbell-Lange <rory(at)campbell-lange(dot)net>
To: Postgresql Novice List <pgsql-novice(at)postgresql(dot)org>
Subject: select 2 random rows
Date: 2002-06-27 22:42:06
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
I'd like to select 2 random rows from a table.
At the moment I'm returning a couple of hundred rows into a perl hash
and randomising it there, but it would be great if I could do it in the
database call.

Each row has an id number created using the SERIAL type.

Thanks for any help.
Rory Campbell-Lange 


pgsql-novice by date

Next:From: stev knowlesDate: 2002-06-27 22:42:33
Subject: command length?
Previous:From: Josh BerkusDate: 2002-06-27 22:37:03
Subject: Re: Date Question

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