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

Duplicate Names

Status
Not open for further replies.

Texsun50

Technical User
Jan 19, 2006
7
0
0
US
This has most likely been answered a thousand times on here, but to keep from searching multiple places, I need help on a query. I have a table that list perpetrators name(s) of child abuse victims. I have up to four names per child in seperate boxes, i.e. name1, name2, name3 and name 4. Each is a text box. What I would like to do, is count the perpetrator name only once in a query. A perpetrator could be the same perpetrator for multiple children, but I only want to count the total number of perpetrators without haviing duplicates in it. I know you guru's can help me, thanks in advance!
 
you should normalise your table, i.e. split that table into 2, 1 to store the child names, and another to store the perp name and a link

or maybe another link table if the relationship is many to many...

It is possible to do what you want with sql, but frankly if you start doing that now, you'll find yourself tied to using un-normalised tables which will get you into serious trouble later on...

--------------------
Procrastinate Now!
 
The table is normalized. I have the children's names on one table (with other info on the child) and the perpetrator's names in another table (with other info on the perp). The problem is, one perpetrator may have abused multiple children. That's where his/her name comes up multiple times on the query. I need to only get his/her name to come up once or basically not have "duplicated names" in the query.

Thanks!
 
I see, so not 4 different fields, but 4 entries in the same field...

in that case, put a distinct behind your select...

note the distinct will limit records which have ALL thier fields distinct, i.e. if you select both the perp and the child then it still will pull up duplicate perp names...

--------------------
Procrastinate Now!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top