473,566 Members | 2,772 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Advice On Random Sample

Hello everyone,

I had a query that took 3,000 random records (which are addresses)from
a table.

This recordset is to send off surveys. I've noticed by looking at the
data, that I have some people who live at the same address. For
instance Bob Smith and Betty Smith. They both live at 120 Elm Street
in Albany New York.

I've also noticed that sometimes you have Bob Smith who lives at 120
Elm Street in Albany New York and then another Bob Smith who lives at
10 Pine Grove in Albany New York.

Because this is a random sample and I dont want to survey the same
person twice, I figure I step through the recordset, find a person with
the same first and last name. Then check if they live in the same
city. If they do, delete the second record.

Can someone give me an idea on code? Also, is there a better way of
doing this? DISTINCT wont work because of the first name (same
address, last name) being different.

Thanks,
Brian

Nov 13 '05 #1
1 2321
Brian,

You first need to purge your people table of duplicates. Then you need a
PersonID primary key that is autonumber. Finally, in your random generator
you need a way to prevent picking any PersonID more than once.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdata sheet.com
www.pcdatasheet.com
"BerkshireG uy" <bd*****@yahoo. com> wrote in message
news:11******** **************@ g49g2000cwa.goo glegroups.com.. .
Hello everyone,

I had a query that took 3,000 random records (which are addresses)from
a table.

This recordset is to send off surveys. I've noticed by looking at the
data, that I have some people who live at the same address. For
instance Bob Smith and Betty Smith. They both live at 120 Elm Street
in Albany New York.

I've also noticed that sometimes you have Bob Smith who lives at 120
Elm Street in Albany New York and then another Bob Smith who lives at
10 Pine Grove in Albany New York.

Because this is a random sample and I dont want to survey the same
person twice, I figure I step through the recordset, find a person with
the same first and last name. Then check if they live in the same
city. If they do, delete the second record.

Can someone give me an idea on code? Also, is there a better way of
doing this? DISTINCT wont work because of the first name (same
address, last name) being different.

Thanks,
Brian

Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2952
by: Bart Nessux | last post by:
New to Python... trying to figure out how to count the objects in a list and then map the count to the objects or convert the list to a dict... I think the latter would be better as I need a number associated with each entry. Any pointers? Also, does this bit of code look to be truely random? def random_number_gen(): winner = ...
9
2249
by: Bart Nessux | last post by:
I am using method 'a' below to pick 25 names from a pool of 225. A co-worker is using method 'b' by running it 25 times and throwing out the winning name (names are associated with numbers) after each run and then re-counting the list and doing it all over again. My boss thinks that 'b' is somehow less fair than 'a', but the only thing I...
21
23110
by: Andreas Lobinger | last post by:
Aloha, i wanted to ask another problem, but as i started to build an example... How to generate (memory and time)-efficient a string containing random characters? I have never worked with generators, so my solution at the moment is: import string import random random.seed(14)
4
3403
by: james blair | last post by:
Hi I am generating a random number using random.randint(1,10000000000) Whats the possibility that the numbers generated will be same when generated by 100 users at the same time? Whats the best method to generate random numbers so that they are most likely unique?? Thanks
2
3448
by: Tim Mackey | last post by:
hi folks, i'm puzzled over this one, anyone with some solid db experience might be able to enlighten me here. i'm modelling a file system in a database as follows, and i can't figure out to cleanly implement an inheritance mechanism. i have a hierarchy of folders in an sql table. every folder has a parentFolderID, if this value is 0...
1
4712
by: steflhermitte | last post by:
Dear cpp-ians, I want to apply a stratified sampling on an image. Following simplified example will explain my problem. The original image I with nrows and ncols is now a vector V of length (nrow x ncol) and every element of the vector contians its pixel value. vector float V ;
4
5093
by: Jesse Noller | last post by:
Hello - I'm probably missing something here, but I have a problem where I am populating a list of lists like this: list1 = list2 = list3 = main_list =
5
2265
by: jordi | last post by:
I need the random.sample functionality where the population grows up to long int items. Do you know how could I get this same functionality in another way? thanks in advance. Jordi
232
13119
by: robert maas, see http://tinyurl.com/uh3t | last post by:
I'm working on examples of programming in several languages, all (except PHP) running under CGI so that I can show both the source files and the actually running of the examples online. The first set of examples, after decoding the HTML FORM contents, merely verifies the text within a field to make sure it is a valid representation of an...
0
7666
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7584
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7888
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8108
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7644
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6260
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5213
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2083
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.