Re: Getting a random set of records from a table?
From: Connor McDonald <connor_mcdonald_at_yahoo.com>
Date: Thu, 25 Nov 1999 17:39:45 +0800
Message-ID: <383D03E1.5C23_at_yahoo.com>
Date: Thu, 25 Nov 1999 17:39:45 +0800
Message-ID: <383D03E1.5C23_at_yahoo.com>
Douglas Scott wrote:
>
> One of my users has a requirement to report on a random set of parts
> from our inventory database every month (need about 40 records) to
> satisfy an audit. This is a government audit requirement (its anybodys
> guess why they want this). Does anyone know an easy way to get a random
> set of records from a table?
>
> Douglas Scott
> dsscott_at_ev1.net
There is the SAMPLE command in 8i.
before this, you can do it with
select *
from ( select rownum therow, p.* from table p) x
where x.therow = LLL
and rownum < no_of_rows_in_sample
where LLL is a suitable random number generator
It won't humm along though...
-- =========================================== Connor McDonald "These views mine, no-one elses etc etc" connor_mcdonald_at_yahoo.com "Some days you're the pigeon, and some days you're the statue."Received on Thu Nov 25 1999 - 10:39:45 CET
