Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Random selection
Message
 
 
À
27/06/2011 06:47:42
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2005
Divers
Thread ID:
01516199
Message ID:
01516202
Vues:
50
Try
DECLARE @RecCount int
SET  @RecCount = 50000 - < # of records in previous 2 groups >
SELECT TOP (@RecCount) 
  FROM mytable 
  WHERE < record does not belong to 2 previous groups >
  ORDER BY NewID()
>
>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
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform