Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 6 of 6 total
Thread Selecting a random number of records
Wed, Aug 29 2007 3:18 PMPermanent Link

Allan Brocklehurst
Hello;
Is there a way to select a random number of records from a table?

TIS

Allan
Wed, Aug 29 2007 4:55 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Allan,

<< Is there a way to select a random number of records from a table? >>

Sure, just set the TDBISAMQuery MaxRowCount property to a Random() value
prior to running the query.

--
Tim Young
Elevate Software
www.elevatesoft.com

Thu, Aug 30 2007 11:27 AMPermanent Link

Allan Brocklehurst

Tim;
YOu answered my question. But it seems I didn't ask the right question
Here goes again
Can I get a  set of, say 100, records selected ramdomly out of a table?

Allan
"Tim Young [Elevate Software]" <timyoung@elevatesoft.com> wrote:

Allan,

<< Is there a way to select a random number of records from a table? >>

Sure, just set the TDBISAMQuery MaxRowCount property to a Random() value
prior to running the query.

--
Tim Young
Elevate Software
www.elevatesoft.com

Thu, Aug 30 2007 12:12 PMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Allan


If you have an integer field to select on you could create a list of random numbers and then do an IN

Roy Lambert
Thu, Aug 30 2007 1:55 PMPermanent Link

"Donat Hebert \(Worldsoft\)"
I think you're looking for something using rand function.  You may want to
set a range according to size of your sample but may not be required.  This
this logic a whirl.  hth  Donat.

Select RecIdent, Rand() as RandNum
Into ATemp
from BgTranyr;

Select *
from ATemp
Order by RandNum
top 100
;


"Allan Brocklehurst" <brock@ns.sympatico.ca> wrote in message
news:E2562D93-8F85-46EF-A3A7-655E211DFF61@news.elevatesoft.com...
> Hello;
> Is there a way to select a random number of records from a table?
>
> TIS
>
> Allan
>

Fri, Aug 31 2007 7:45 AMPermanent Link

Allan Brocklehurst


Thanks  al of you guys for this. These will work

Allan
"Donat Hebert \(Worldsoft\)" <donat.hebert@worldsoft.ca> wrote:

I think you're looking for something using rand function.  You may want to
set a range according to size of your sample but may not be required.  This
this logic a whirl.  hth  Donat.

Select RecIdent, Rand() as RandNum
Into ATemp
from BgTranyr;

Select *
from ATemp
Order by RandNum
top 100
;


"Allan Brocklehurst" <brock@ns.sympatico.ca> wrote in message
news:E2562D93-8F85-46EF-A3A7-655E211DFF61@news.elevatesoft.com...
> Hello;
> Is there a way to select a random number of records from a table?
>
> TIS
>
> Allan
>

Image