Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
ackweb
Yak Posting Veteran
54 Posts |
Posted - 2005-04-27 : 14:06:54
|
| I'm trying to come up with a way to pick one record at random from a group of qualifying records; similar to a raffle. I've looked at the RAND() function, but the result must be one of the qualifying records. Similar to a raffle, I'd like the probability of any one records being chosen to be equal. I'd appreciate any suggestions. Thanks! |
|
|
Kristen
Test
22859 Posts |
Posted - 2005-04-27 : 14:13:34
|
| SELECT TOP 1 ...FROM MyTableORDER BY NewId()Kristen |
 |
|
|
JimL
SQL Slinging Yak Ranger
1537 Posts |
Posted - 2005-04-27 : 15:42:32
|
| Well I learned a new one.Good Show KristenJimUsers <> Logic |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2005-04-28 : 05:06:52
|
My old age showing, is it? |
 |
|
|
|
|
|