random select [message #371338] |
Wed, 04 October 2000 14:27 |
CARLOS
Messages: 24 Registered: February 2000
|
Junior Member |
|
|
Hi, I need to select n random lines from the table. Anyone can help me? I'm stuck!
Regards,
Carlos
|
|
|
Re: random select [message #371339 is a reply to message #371338] |
Wed, 04 October 2000 15:01 |
priscilla Gathoni
Messages: 1 Registered: October 2000
|
Junior Member |
|
|
Use the following syntax:
proc sql;
create table tablename as select *,
ranuni(-1) as random
from yourlib.yourdata;
order by variablename, random;
if first.variablename then count=0;
count+1;
if count <= n then output;
quit;
|
|
|
Re: random select [message #371340 is a reply to message #371339] |
Wed, 04 October 2000 15:27 |
CARLOS
Messages: 24 Registered: February 2000
|
Junior Member |
|
|
Sorry, but I'm really new to oracle... this oracle database was installed and used by another person which is not here since last week. Now I need the information.
I got the idea of you script (except for the create table), but where I run it? Where I got the results? SQL Plus? Enterprise Manager? Thanx!
Regards,
Carlos
|
|
|