Oracle/SQL help

\\OFF-TOPIC// conversations about everything that has nothing to do with Conquer Club.

Moderator: Community Team

Forum rules
Please read the Community Guidelines before posting.
Post Reply
User avatar
wicked
Posts: 15787
Joined: Thu Jan 26, 2006 1:23 pm

Oracle/SQL help

Post by wicked »

Anyone familiar with writing SQL scripts? Is there anyway I can get a random sample from a script? Right now, I'm spooling a huge list, exporting to excel and doing it there. Takes forever to generate the list, so was wondering if SQL could do it for me.

Thanks! 8)
Darkfire001
Posts: 139
Joined: Mon Jan 23, 2006 4:37 pm
Location: Cary, NC

Post by Darkfire001 »

When you say generate random sample, do you mean just pull some particular fields or a row out and generate it from that? There are a variety of ways, but an easy way would be just use "numrows" to find total rows, set that as the limit for a random number, and then pull a field based on the primary key. Thats a jiggy-rigged way to do it since if you have an incomplete dataset you'd have some issues, but thats the easiest method I can think of off the top of my head.
User avatar
wicked
Posts: 15787
Joined: Thu Jan 26, 2006 1:23 pm

Post by wicked »

I'm generating a huge list of ID numbers (thousands+) through a SQL script, of which I need to pull out 100 random ID's. I'm doing this for 6 different data sets. It's been spooling for about an hour now...LOL. I was hoping there was a way I could have sql pick 100 random ID's that meet set criteria w/o even generating the list (or so that I didn't have to see it and have it take hours). Make sense?

Thanks! :-)
User avatar
wicked
Posts: 15787
Joined: Thu Jan 26, 2006 1:23 pm

Post by wicked »

nevermind, I found a way to limit my list another way ... thanks!
User avatar
parno4u
Posts: 599
Joined: Fri Dec 22, 2006 6:55 pm
Gender: Male
Location: Oklahoma

Post by parno4u »

bump
User avatar
ignotus
Posts: 2766
Joined: Thu Sep 06, 2007 9:34 am
Location: Hanging on to my old avatar.
Contact:

Post by ignotus »

parno4u wrote:bump


why?
heavycola wrote:
Snorri1234 wrote:Man, this thread was great. A whopping 230 pages with noone changing their viewpoint.


I actually converted around page 198. Unfortunately, I converted to satanism.
blackjoke
Posts: 5
Joined: Mon Dec 10, 2007 8:16 am

Post by blackjoke »

Out of curiosity did you limit your list length or find a way of getting a specific number of random selections?
User avatar
wicked
Posts: 15787
Joined: Thu Jan 26, 2006 1:23 pm

Post by wicked »

I really don't remember. :lol: That was 1.5 years ago! :wink:
Post Reply

Return to “Acceptable Content”