List:General Discussion« Previous MessageNext Message »
From:Sasha Pachev Date:June 16 1999 11:09am
Subject:Re: RANDOM RAW
View as plain text  
Dejan Lekic wrote:
> Hi to all
> Is there easy way to get RANDOM raw from some table?
> Dejan

There are many rather easy ways, here is one:

select count(*) 

rememeber the number of rows (n)

pick a random number between 1 and n (r) ( in C you will say r = 1 +
rand() % n; )

select * from tbname limit $r, 1

but WHY? Databases are there to create order :-)

Sasha Pachev (home) (work)
RANDOM RAWDejan Lekic16 Jun
  • Re: RANDOM RAWSasha Pachev16 Jun