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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Random select statement from existing results...

Status
Not open for further replies.

lennym

Technical User
Mar 15, 2000
6
CA
I need to perform a select statement where I select a 4% random sample of the results of a query. EG: I select a group of records from a table based on a date range and then I want to select a random 4% sample of the results. Does anyone have any suggestions for this?

Thanks muchly.
 
declare @x integer
set @x = 10000 * rand()
---getting a four digit number
set @x = @x % 10
---setting it to < 10, also a random
select * from OneTable where OneRow = @x
John Fill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top