473,387 Members | 1,530 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,387 software developers and data experts.

Need to know how to delete duplicate records in Access

1
I was able to get a query out showing all the duplicate records but know I need the duplicates to be sent to another table

any ideas?
Nov 4 '06 #1
4 3585
Use the INTO keyword after the select part of your query listing duplicates IE

Select Field1,Field2 etc INTO NewFile from ATable where etc.

This turns the query into a make table query & it will place its output into the file specified
Nov 4 '06 #2
PEB
1,418 Expert 1GB
I agree with Andrew but he don't say anything about deleting the dublicate rows in your table :) I bit annoying task to be done...

So I suppose that you have a query that retrieves all dublicates on a field named My_field... So in your query you have My_field and number of repetitions colum with values greater than 1.

In your table with the records to delete add a column of type Yes/No named to_delete

So I suppose that in your table you have also an ID that is unique without dublicates

So create second query that retrieves the first row from the dublicates with min ID... Use the top values

Create a thirth query to retrieve the dublicates values retrieve the top values from the previous query and tell that the values in this one should be different from the id of the top values query...

See the results in SELECT view if you are ok to place those rows on a new location than you should transform this query in Update query
and update to_delete column to Yes

Then follow the instructions of Andrew and delete them...

:)
Nov 4 '06 #3
If the entire record is duplicated try this approach

1) Creater a query to dump the uniue set of records into a temporary table

Expand|Select|Wrap|Line Numbers
  1.  
  2. Select  Distinctrow  * into TempTable from OriginalTable
  3.  
  4.  
now delete the original table and rename the temp table to the original table name
(After checking the query worked properly, of course)
Nov 5 '06 #4
PEB
1,418 Expert 1GB
Hey,

There is better way without creating complementary columns...

Once the query with dublicates created...

In a Delete query you can include the dublicate query results as condition:

IN (SELECT Dublicated_field FROM DUBLICATES)

ALSO invoke the query with the TOP Values UNDER THE ID COLUMN:

NOT IN (SELECT TOP 1 ID FROM MYTABLE WHERE Dublicated_field IN (SELECT Dublicated_field FROM DUBLICATES))

And you can execute your delete query based on your table with those conditions

:)
Nov 5 '06 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: Mark | last post by:
I have a table about people containing 25 fields. The table contains the usual fields - first, last, address, city, state and zip. There is no primary key. These fields all have data with the...
4
by: KT | last post by:
Is there any one click solution that would do the trick? I would like to create a button, so the person who maintains the database can perform clean up work to delete duplicate records which...
15
by: Cheryl Langdon | last post by:
Hello everyone, This is my first attempt at getting help in this manner. Please forgive me if this is an inappropriate request. I suddenly find myself in urgent need of instruction on how to...
16
by: Theodore70 | last post by:
I am trying to delete duplicate records in an access table using VB. Not a programmer here, but this was one of the codes that I found on the web. I made some modifications to it, but it still did...
3
by: itoxic07 | last post by:
how to delete the records ? i am having problem deleting the records including the duplicate records from access database. I inserted a textbox on a form ,the name written in a textbox must be...
3
by: rajeshkrsingh | last post by:
Hi friends, Step1- create table duplicate ( intId int, varName varchar(50) ) insert into duplicate(intId,varName) values(1,'rajesh') insert into duplicate(intId,varName) values(2,'raj12')...
2
by: drewpgc | last post by:
Hello, I am new here, and pretty new to access. I was thrown into the fire a bit here at my new job and I have a large database of about 12,000 records. I simply need to find all the duplicate...
7
by: jmstur2 | last post by:
I have a table with what I consider duplicate records. Data in all columns are duplicate except for the date column, meaning that duplicate data was entered on different dates and those dates were...
6
by: Dilip1983 | last post by:
Hi All, I want to delete duplicate records from a large table. There is one index(INDEX_U1) on 4 columns(col1,col2,col3,col4) which is in unusable state. First of all when i tried to rebuild...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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:
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...

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.