Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Random selection
Message
 
 
To
27/06/2011 06:47:42
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2005
Miscellaneous
Thread ID:
01516199
Message ID:
01516215
Views:
30
Try
;with cte as (select *, row_number() over (partition by GroupCondition order by NewID()) as RandomRow from People)

select * from cte where RandomRow <=25000
>Hi
>
>I have a task
>
>I want to select a list of people from my database.
>
>Total number to be selected 50000
>
>including all of two groups.
>
>Group 1 people who have joined 6 to 12 months ago.
>
>and
>
>Group 2 people who have previously paid
>
>so I imagine the group1 and group 2 will come to about 20000.
>
>How can I select a random selection of the rest.
>
>Any thoughts .
>
>Thanks
>
>Nick
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform