473,473 Members | 2,213 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

I get duplicate records when I query?

I don't know what I am doing wrong I get duplicate records when I query

Here is my SQL query code:

SELECT Utilization_T.Facid, Utilization_T.Year, Utilization_T.Beds,
Utilization_T.LicBeds,
Utilization_T.NursingCare, Utilization_T.GenLicBeds, FormatDate(Now())
AS Expr1, Staffing_T.Username
FROM Staffing_T INNER JOIN Utilization_T ON Staffing_T.facid =
Utilization_T.Facid
ORDER BY Utilization_T.Facid;

I compared it to an Access database that I had previously used this
code, successfully

Everything looks the same?

This data contains records from 2004 and 2005...So I deleted,
previously, 2004 records

Thanks!

Sep 13 '06 #1
2 2249
GH
Without more detail about your duplication (are all records duplicated
like in a Cartesian join or are only some records duplicated and are
all field values in the "duplicates" the same) it is tough to answer
your question. You could try adding DISTINCT after SELECT to limit the
records returned, which would have solved an issue where you had
multiple years for the same information as long as the other fields in
the record are the same, since the year was not part of your initial
query, but I am not positive this is the problem you are having. If
making your query a DISTINCT query does not solve your problem, you
need to provide more information about your duplicates.

- GH

jmarr02s wrote:
I don't know what I am doing wrong I get duplicate records when I query

Here is my SQL query code:

SELECT Utilization_T.Facid, Utilization_T.Year, Utilization_T.Beds,
Utilization_T.LicBeds,
Utilization_T.NursingCare, Utilization_T.GenLicBeds, FormatDate(Now())
AS Expr1, Staffing_T.Username
FROM Staffing_T INNER JOIN Utilization_T ON Staffing_T.facid =
Utilization_T.Facid
ORDER BY Utilization_T.Facid;

I compared it to an Access database that I had previously used this
code, successfully

Everything looks the same?

This data contains records from 2004 and 2005...So I deleted,
previously, 2004 records

Thanks!
Sep 13 '06 #2
As a quick test, change the directions of your joins. Only show matching
records in either tables based upon changing the join types.
"jmarr02s" <jo***********@illinois.govwrote in message
news:11*********************@i3g2000cwc.googlegrou ps.com...
>I don't know what I am doing wrong I get duplicate records when I query

Here is my SQL query code:

SELECT Utilization_T.Facid, Utilization_T.Year, Utilization_T.Beds,
Utilization_T.LicBeds,
Utilization_T.NursingCare, Utilization_T.GenLicBeds, FormatDate(Now())
AS Expr1, Staffing_T.Username
FROM Staffing_T INNER JOIN Utilization_T ON Staffing_T.facid =
Utilization_T.Facid
ORDER BY Utilization_T.Facid;

I compared it to an Access database that I had previously used this
code, successfully

Everything looks the same?

This data contains records from 2004 and 2005...So I deleted,
previously, 2004 records

Thanks!

Sep 13 '06 #3

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

Similar topics

3
by: Giloosh | last post by:
Hello, i need some help if possible... i have a payments table with over 500 records i want to run a query that searches through the table spotting out any duplicate ID#'s and Dates. So basically...
1
by: Rado | last post by:
Hi All, This might quite simple process for some but I am finding it really difficult to do. What is required is not a standard Duplicate query but a variation on it. For example I have...
2
by: ms | last post by:
Access 2000: I am trying to delete duplicate records imported to a staging table leaving one of the duplicates to be imported into the live table. A unique record is based on a composite key of 3...
6
by: sara | last post by:
I have a procedure to automate bringing several Excel files into our Access tables, on a daily basis. The problem is that if the user has a problem, and tries to run the import again (maybe 3...
2
by: mivey4 | last post by:
Okay I have 2 tables: Table A - holds a list of new hardware serial numbers and their corresponding model (no constraints or indexes) Table B - holds a distinct list of current serial numbers...
2
by: nethravathy | last post by:
Hi, The following table namely elcbtripselect contains 5147 records.I want to know wether this table contains duplicate records or not. I tried with following query 1)SELECT...
1
by: PerumalSamy | last post by:
Hi I am having table with more 13 lakhs records. I am having duplicate records in it. i need to remove that. I wrote the following query SELECT *
1
by: colin-whitehead | last post by:
I have 2 tables tblReports primary key UPN, plus numeric fields Effort, Attain, etc tblComments numeric primary key ID & textfield Text In the Query I select each record from tblReports...
4
by: Thomas Arthur Seidel | last post by:
Hello to all, I have a small or big problem with a customer data base, where during a change of system we might have created duplicate records. This should be easy to find, you might think, but,...
0
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,...
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,...
1
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,...
1
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.