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.
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.
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?