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 |
jonhath
Starting Member
13 Posts |
Posted - 2007-08-23 : 15:48:02
|
Hi all,I'm trying to come up with an efficient way to select demographics from a dataset. We will have a few thousand candidates (hopefully!) and need to select 200 from each state based on age, education and sex criteria. For example:INSERT INTO dbo.Selected_CandidatesSELECT TOP (3) submissionkeyFROM dbo.CandidatesWHERE (State = 'IOWA') AND (Sex = 'M') AND (Age >= 25) AND (Age <= 44) AND Education = '1'ORDER BY NEWID() There will be forty possible combinations, so forty statements exactly like the one above for each state. I really really really don't want to write out 40 statements like this, plus I'll need to run an access report that finds out how many of each we have so we can see if we need more from a certain demographic. I'm wondering if anyone has any ideas to make this less time consuming. Is there any software out there that is made for selecting demographics?Thanks a lot |
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-08-23 : 15:59:02
|
http://weblogs.sqlteam.com/mladenp/archive/2005/08/01/7421.aspxpoint 2_______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenp |
 |
|
|
|
|