Re: Randomizing resultssets
From: Connor McDonald <connor_mcdonald_at_yahoo.com>
Date: 2000/08/06
Message-ID: <398D01FE.4BCC_at_yahoo.com>#1/1
Date: 2000/08/06
Message-ID: <398D01FE.4BCC_at_yahoo.com>#1/1
davidai_at_shopnow.com wrote:
>
> I want to write a stored procedure that returns a set of 6 records
> randomly selected from a table. What is the best way of implementing
> this?
>
> David
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Not spectacularly efficient, but you can do
select *
from (
select *
where <x> is the random number generator function of your choice..
HTH
from table
order by <x> )
where rownum < 7
--
===========================================
Connor McDonald
http://www.oracledba.co.uk
We are born naked, wet and hungry...then things get worse
Received on Sun Aug 06 2000 - 00:00:00 CEST