473,396 Members | 1,772 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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.Description Event.description
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 3434
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.net> 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.Description Event.description
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.PatientID, Illness.Description, Event.AutoID, Event.Description, Illness.SeqNum
FROM Illness INNER JOIN Event ON (Illness.Description = Event.Description) AND (Illness.PatientID =
Event.PatientID);

On Fri, 10 Oct 2003 01:57:09 GMT, "Larry Linson" <bo*****@localhost.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.net> 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.Description Event.description
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
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: ...
2
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...
3
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...
16
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...
7
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,...
5
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...
16
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...
4
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...
1
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...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
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,...
0
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...
0
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...
0
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,...

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.