473,767 Members | 8,025 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Unwanted duplicates in query

Hello--I have 2 tables (illness,event) that a need to query and create a recordset
The key fields are personId and description (text field) in each table. I also have other needed
fields in the query but these are the 2 that join the 2 tables. I also have unique id's for each
table (autoID, SeqNum). It runs ok except one issue--I have some unwanted duplicates in the result--
For each ID in either table--the description may not be unique

for instance:
Illness table:
PatientID AutoID Description
113 242 UTI
113 347 UTI

Event table:
PatientID SeqNum Description
113 1237 UTI
113 2898 UTI

I then get this in the query:
PatientID AutoID SeqNum Illness.Descrip tion Event.descripti on
113 242 1237 UTI UTI
113 242 2898 UTI UTI
113 347 1237 UTI UTI
113 347 2898 UTI UTI

For any records where there is not more than one similar value for the description field within
each patient id--the query runs fine. For the case above they do not. There is not other field
common to both tables that I can filter by. Does anyoine know why this is happening and how I can
solve it? The data is correct in both tables.

Thank you
Nov 12 '05 #1
2 3456
Make sure you have joined the tables... looks like a "Cartesian Product",
maybe, resulting from having two tables as data sources in a query, but not
joined.

Copy and paste the SQL property of your Query -- then we'll have a better
idea.

Larry Linson
Microsoft Access MVP

<al*****@cox.ne t> wrote in message news:3f******** *****@news.west .cox.net...
Hello--I have 2 tables (illness,event) that a need to query and create a recordset The key fields are personId and description (text field) in each table. I also have other needed fields in the query but these are the 2 that join the 2 tables. I also have unique id's for each table (autoID, SeqNum). It runs ok except one issue--I have some unwanted duplicates in the result-- For each ID in either table--the description may not be unique

for instance:
Illness table:
PatientID AutoID Description
113 242 UTI
113 347 UTI

Event table:
PatientID SeqNum Description
113 1237 UTI
113 2898 UTI

I then get this in the query:
PatientID AutoID SeqNum Illness.Descrip tion Event.descripti on
113 242 1237 UTI UTI
113 242 2898 UTI UTI
113 347 1237 UTI UTI
113 347 2898 UTI UTI

For any records where there is not more than one similar value for the description field within each patient id--the query runs fine. For the case above they do not. There is not other field common to both tables that I can filter by. Does anyoine know why this is happening and how I can solve it? The data is correct in both tables.

Thank you

Nov 12 '05 #2
Thanks for responding==the SQL is below:

SELECT Illness.Patient ID, Illness.Descrip tion, Event.AutoID, Event.Descripti on, Illness.SeqNum
FROM Illness INNER JOIN Event ON (Illness.Descri ption = Event.Descripti on) AND (Illness.Patien tID =
Event.PatientID );

On Fri, 10 Oct 2003 01:57:09 GMT, "Larry Linson" <bo*****@localh ost.not> wrote:
Make sure you have joined the tables... looks like a "Cartesian Product",
maybe, resulting from having two tables as data sources in a query, but not
joined.

Copy and paste the SQL property of your Query -- then we'll have a better
idea.

Larry Linson
Microsoft Access MVP

<al*****@cox.n et> wrote in message news:3f******** *****@news.west .cox.net...
Hello--I have 2 tables (illness,event) that a need to query and create a

recordset
The key fields are personId and description (text field) in each table. I

also have other needed
fields in the query but these are the 2 that join the 2 tables. I also

have unique id's for each
table (autoID, SeqNum). It runs ok except one issue--I have some unwanted

duplicates in the result--
For each ID in either table--the description may not be unique

for instance:
Illness table:
PatientID AutoID Description
113 242 UTI
113 347 UTI

Event table:
PatientID SeqNum Description
113 1237 UTI
113 2898 UTI

I then get this in the query:
PatientID AutoID SeqNum Illness.Descrip tion Event.descripti on
113 242 1237 UTI UTI
113 242 2898 UTI UTI
113 347 1237 UTI UTI
113 347 2898 UTI UTI

For any records where there is not more than one similar value for the

description field within
each patient id--the query runs fine. For the case above they do not.

There is not other field
common to both tables that I can filter by. Does anyoine know why this is

happening and how I can
solve it? The data is correct in both tables.

Thank you



Nov 12 '05 #3

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

Similar topics

3
4612
by: Tom Mitchell | last post by:
All: I'm stumped on a query. How do I find duplicates in a table where one of the duplicates has values is a certain field and the other doesn't. For example, I have the following table: tblItems ItemID ItemLabel
2
3419
by: M.Stanley | last post by:
Hi, I have a problem..I'm doing a specific query where I'm joining fields from a table with appednded data (there are duplicate records, except for the date/time), and another query. I want the results of the new query to return ALL of the matches, and only the latest record when it finds duplicates. Performing a return top values doesn't work because it doesn't return all of the matchs, using LAST in the date field criteria only...
3
4825
by: Sim Zacks | last post by:
I am using 8.0 beta 1 on an RH 8 Linux server. I have a union query that I am converting from access (where it worked) and it is returning duplicates. The only difference between the two rows is the Row field, which is returned automatically. and an example of a row that it has returned duplicate. I have verified that the row only shows up 1 time in each select statement when run individually.
16
4185
by: tyrfboard | last post by:
I've been searching for awhile now on how to remove duplicates from a table within an Access db and have found plenty of articles on finding or deleting duplicates. All I want to do is remove them from within an SQL query - leaving one of the records behind of course. I have a mailing list comprised of a union query that gets records from two separate tables. I want to be able to run a query that removes one (or more) of the duplicated...
7
2288
by: Edward Elliott | last post by:
I'm looking for the "best" way to strip a large set of chars from a filename string (my definition of best usually means succinct and readable). I only want to allow alphanumeric chars, dashes, and periods. This is what I would write in Perl (bless me father, for I have sinned...): $filename =~ tr/\w.-//cd, or equivalently $filename =~ s/// I could just use re.sub like the second example, but that's a bit overkill. I'm trying to...
5
2281
by: BillCo | last post by:
I'm having a problem with a union query, two simple queries joined with a union statement. It's created in code based on parameters. Users were noticing some inconsistant data and when I analysed the query produced and opened it from a MS Query it started giving strange results. The first query when run alone returns 22 records, some of which have identical values in all fields. This is 100% correct. The second query returns nothing....
16
3518
by: ARC | last post by:
Hello all, So I'm knee deep in this import utility program, and am coming up with all sorts of "gotcha's!". 1st off. On a "Find Duplicates Query", does anyone have a good solution for renaming the duplicate records? My thinking was to take the results of the duplicate query, and somehow have it number each line where there is a duplicate (tried a groups query, but "count" won't work), then do an update query to change the duplicate to...
4
3022
by: apatel85 | last post by:
Hey Guys, Total Number of Records (Based on 5 fields): 1000 Total Unique Records (Based on 5 Fields): 990 Total number of fields: 5 I have question regarding extracting duplicates from the dataset. I have 2 fields that makes a record unique. I have used group by function to find duplicates and got 10 records that are duplicating. Each records duplicating 1 times, thus, 10 unique records and 10
1
2165
by: tskmjk55 | last post by:
Recently, I have a requirement to develop a vb.net application wherein the input excel sheet data which has an average of 5000 records should be checked for Internal duplicates (duplicates within the same sheet) and external duplicates (duplicates which exist outside this sheet). I have gone through lot of logics..some of which are ... - Common and currently testing out.. - First insert the excel sheet data into DB..then query by...
0
9575
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10014
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9960
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
9841
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7384
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6656
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5425
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3931
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
3
2808
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.