473,396 Members | 2,013 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.

Duplicate records - query

Hi,

I have two incomplete lists of staff which combined create a full list of
staff with duplicates. I wish to create a full list with no duplicates.
Each member of staff has and obviously a name. I wish to select the list of
staff using the code, but here lies the problem. The naming is not entirely
consistent

Table 1
Code Name
SMJ Mr. J. Smith

Table 2
Code Name
SMJ Mr J. Smith

In a query using SELECT DISTINCT - I end up with these being two records
because of the "." after the Mr! If I only select on the basis of code,
then fine, bu I want to return both the Code and the name.

Thanks in advance
Nov 13 '05 #1
1 1481
Hi John,

Do a Totals query on the data like this (where Table_Joined is the
combined data from Table 1 and Table 2):

SELECT Code, First(Name) AS UserName
FROM Table_Joined
GROUP BY Code;

This query ensures you will only get one name for each code. (Of course
you'll have a different problem if you have multiple _actual_ users for
any one code. In that case a different approach would be required.)

By the way, "Name" is a reserved word in Access (like "Date", "Value",
etc.), so shouldn't be used as a field name.

------------
LoopyNZ
------------
------------------------------
Original Message:

Duplicate records - query
From: John M
Date Posted: 9/23/2004 11:23:00 PM

Hi,

I have two incomplete lists of staff which combined create a full list
of
staff with duplicates. I wish to create a full list with no duplicates.
Each member of staff has and obviously a name. I wish to select the list
of
staff using the code, but here lies the problem. The naming is not
entirely
consistent

Table 1
Code Name
SMJ Mr. J. Smith

Table 2
Code Name
SMJ Mr J. Smith

In a query using SELECT DISTINCT - I end up with these being two records
because of the "." after the Mr! If I only select on the basis of code,
then fine, bu I want to return both the Code and the name.

Thanks in advance

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #2

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...
1
by: JG | last post by:
I have an Access 2000 database with a query in it that is pulling data from a table that has duplicate records in it. It is doubling my currency out put. To get rid of the duplicate records in the...
2
by: jmarr02s | last post by:
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,...
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...
1
by: xraive | last post by:
I have a problem with this. Currently I am trying Allen's code and i am not successful. Current Design Table1 (Main Form) TravelID (PK) ApprovedBY EntreredBy BudgetCode ExpenseCode
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
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
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...
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.