Re: selecting a random record

From: Culley Harrelson <culleyharrelson(at)yahoo(dot)com>
To: Mark Lane <mlane(at)mynewthing(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: selecting a random record
Date: 2001-02-06 21:25:54
Message-ID: 20010206212554.81167.qmail@web9604.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Can this be done in the framework of plpgsql? I know
I can do it in the front end (java) but it would be
nice to aviod having to grab the rowcount first. I
haven't seen a random function in the documentation.
I could install another language but boy am I lazy :)

--- Mark Lane <mlane(at)mynewthing(dot)com> wrote:
> On Tuesday 06 February 2001 13:11, you wrote:
> > Any suggestions on how to select a random record
> from
> > any given table?
> >
> > Culley
> >
> Set the range of the table index to a random number
> generator.
>
> if the index ranges from 100 to 10000 then you would
> multiply you random
> number by 9900 and then 100 to generate a random
> index number. Just remember
> to round the number to an integer.
>
> Mark

__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - Buy the things you want at great prices.
http://auctions.yahoo.com/

Browse pgsql-general by date

  From Date Subject
Next Message Mitch Vincent 2001-02-06 21:27:11 Re: full text searching
Previous Message Tim Uckun 2001-02-06 21:06:22 Re: new type proposal