Welcome to dbForumz.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Deleting Duplicates

 
   Database Forums (Home) -> MS Access RSS
Next:  IE 8 Beta 2 Virus detection?  
Author Message
Tom152

External


Since: Aug 15, 2004
Posts: 106



(Msg. 1) Posted: Sat Dec 27, 2008 6:47 am
Post subject: Deleting Duplicates
Archived from groups: microsoft>public>access (more info?)

On a monthly basis I receive a text file that adds new current data to it
along with previous data already received.

First, I add a colunm to this data, to make comments to review for posible
errors each month to data received. About 5% I make a comment in this new
column each month.

When importing the monthly data, I delete all records that are the exact
same for all fields and send to another database. The problem I am having is
that it will not delete any duplicate records that I have entered a comment
in the field I made.

Is thier a way to delete all duplicate records and ignore only the one
column I have created?

Your help is appreciated.
Thanks
--
Tom

 >> Stay informed about: Deleting Duplicates 
Back to top
Login to vote
a a r o n _ k e m p f

External


Since: Jul 01, 2008
Posts: 57



(Msg. 2) Posted: Sat Dec 27, 2008 8:26 am
Post subject: Re: Deleting Duplicates [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

you need SQL Server to do this

if you try to do this in Jet, you go to edit a table while other
people have it open-- you get a locking error message (bug).

-Aaron





On Dec 27, 6:47 am, Tom wrote:
> On a monthly basis I receive a text file that adds new current data to it
> along with previous data already received.
>
> First, I add a colunm to this data, to make comments to review for posible
> errors each month to data received. About 5% I make a comment in this new
> column each month.
>
> When importing the monthly data, I delete all records that are the exact
> same for all fields and send to another database. The problem I am having is
> that it will not delete any duplicate records that I have entered a comment
> in the field I made.
>
> Is thier a way to delete all duplicate records and ignore only the one
> column I have created?
>
> Your help is appreciated.
> Thanks
> --
> Tom

 >> Stay informed about: Deleting Duplicates 
Back to top
Login to vote
Ken Sheridan

External


Since: Dec 27, 2008
Posts: 3



(Msg. 3) Posted: Sat Dec 27, 2008 8:48 am
Post subject: Re: Deleting Duplicates [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Tom:

Firstly, ignore Aaron; he's clearly forgotten to take his medication
again.

Compare all columns apart from your Comments column, e.g. as a SELECT
query:

SELECT *
FROM Table1
WHERE EXISTS
(SELECT *
FROM Table2
WHERE Table2.SomeColumn = Table1.SomeColumn
AND Table2.SomeOtherColumn = Table1.SomeOtherColumn
AND Table2.YetAnotherColumn = Table1.YetAnotherColumn);

If this returns the correct rows to be archived/deleted you can then
easily create and execute modified versions of it, one to append the
rows to the 'archive' table and the other to delete the rows from the
original table.

Ken Sheridan
Stafford, England

On Dec 27, 2:47 pm, Tom wrote:
> On a monthly basis I receive a text file that adds new current data to it
> along with previous data already received.
>
> First, I add a colunm to this data, to make comments to review for posible
> errors each month to data received. About 5% I make a comment in this new
> column each month.
>
> When importing the monthly data, I delete all records that are the exact
> same for all fields and send to another database. The problem I am having is
> that it will not delete any duplicate records that I have entered a comment
> in the field I made.
>
> Is thier a way to delete all duplicate records and ignore only the one
> column I have created?
>
> Your help is appreciated.
> Thanks
> --
> Tom
 >> Stay informed about: Deleting Duplicates 
Back to top
Login to vote
Tom152

External


Since: Aug 15, 2004
Posts: 106



(Msg. 4) Posted: Sat Dec 27, 2008 10:08 am
Post subject: deleting duplicates [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Sheridan
Thank you---but I do not understand your reply
--
Tom
 >> Stay informed about: Deleting Duplicates 
Back to top
Login to vote
Ken Sheridan

External


Since: Dec 27, 2008
Posts: 3



(Msg. 5) Posted: Sat Dec 27, 2008 10:36 am
Post subject: Re: deleting duplicates [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Tom:

The SQL I sent you is for a query which compares the two tables on the
basis of (for simplicity in the example) three columns, all of which
must have identical values for the rows from Table1 to be returned.
It works by means of a subquery with a series of expressions, one for
each column, tacked together with AND operators. So each expression
must be true for the subquery to return any rows. The expressions
compare the columns in the subquery's table (table2) with those in the
outer query's (Table1). By using the EXISTS predicate in the outer
query's WHERE clause it will only return rows where the subquery
returns at least one row for each of the outer query's rows. So the
outer query will return a row from Table1 if there is an exact match
in any row in Table2 in all of the columns you specify. By excluding
your Comments column from the expressions in the subquery therefore,
it will consequently still detect duplicates irrespective of the
comments you've added.

To test it just paste the SQL statement into a new query in SQL view,
change the table and column names to your own, adding further ANDed
expressions to the subquery for the other columns apart from your
Comments column. It should then return the 'duplicated' rows,
including any to which you've added comments.

You can easily amend the query to an 'append' query to copy the
duplicated rows to an 'archive' table, and to a 'delete' query to
remove duplicated the rows from the original. This can be done in
design view rather than SQL view if you switch to that, saving the
query under a different name for each type. Each month you'd execute
the 'append' query to archive the rows before the 'delete' query of
course.

Ken Sheridan
Stafford, England

On Dec 27, 6:08 pm, Tom wrote:
> Sheridan
> Thank you---but I do not understand your reply
> --
> Tom
 >> Stay informed about: Deleting Duplicates 
Back to top
Login to vote
Arvin Meyer [MVP]

External


Since: Oct 02, 2008
Posts: 66



(Msg. 6) Posted: Sat Dec 27, 2008 8:41 pm
Post subject: Re: Deleting Duplicates [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"a a r o n _ k e m p f" wrote in message



> SQL Server is the worlds most popular database..

Actually, that honor would go to Access which probably has more users, and
more databases in use, than all other databases combined. SQL-Server is very
popular, but comes in behind Oracle, which is the largest used server based
database. For my money, SQL-Server is way ahead of Oracle in features, but
it's hard to beat a system that's been around since 1972 and runs on almost
any platform.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com
 >> Stay informed about: Deleting Duplicates 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Leaving only unique records or deleting ALL duplicates - Maybe I've been just thinking about this to hard......I have 2 tables with that contain a document number. Table 1 is to be the new updated table and table 2 have older the information. Some of the records that have been created in table 1 already..

Hide Duplicates - Hi, I recently had a problem selecting dates from a parameter query, and I wrote to this forum and was helped by several of you. I have now encountered another problem that I can't seem to figure out at all. I have a database that tracks employee driver...

Deleting 250000+ rows at once - Hi! In a system, which collects data and the summarises it, we collect a large amount of data. Now, there seems to be a problem, when we try to delete just 16000 rows (entire table btw) or some 250000 rows in another table. My test table is totally 94..

Deleting blank records using code - I want to write a code that goes through a table and delete all blank rows. Is there a way to do this? If so, where do I get some information about it. Thanks

Deleting report in MSACCESS shuts down database - When I try to open/delete or select a report from the OBJECTS window the database shuts down by itself. This report is a copy of a report that functions normally. the only difference is that its control source is a querie and not a table. when i..
   Database Forums (Home) -> MS Access All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]