By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,608 Members | 3,801 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,608 IT Pros & Developers. It's quick & easy.

I get duplicate records when I query?

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.