Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sql random query

Status
Not open for further replies.

rushie84

Programmer
Joined
Jul 31, 2003
Messages
8
Location
US
How can i query a list of names to get a randomly selected list of 5% of the people? Thanks!
 
what database are you using?

Ion Filipski
1c.bmp

ICQ: 95034075
AIM: IonFilipski
filipski@excite.com
 
This is a SQL Server forum. Please post this question in the Access forum.

--James
 
Oops, sorry. Forgot where I was for a second there!

You would still be better off posting this in the Access forum though.

--James
 
you could solev your problem if you add an integr random number colum to your table like this
alter yourtable add column(yourRndColumn integer)

update yourtable set yourRndColumn = Rnd() * 20

the last step

select * from yourtable
where yourRndColumn = 1

instead of 1 you could also put a any other random numbers.

so you will select randomly 5% of

Ion Filipski
1c.bmp

ICQ: 95034075
AIM: IonFilipski
filipski@excite.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top