Re: Finding duplicates, then selecting files with different values



On Fri, 29 Jun 2007 10:36:03 -0700, JerryT <JerryT@xxxxxxxxxxxxxxxxxxxxxxxxx>
wrote:

I am trying to find duplicates from a table and then limit those records by
selecting lines where my ID field contains different data. For example, I
have dupliacte records from a insurance claims table and I now want to show
claims where a doctor is using two IDs to bill claims.
ID Date Procedure
1 06/29/07 99213
2 06/29/07 99213

After I find the duplicates how do I limit these records by showing only the
duplicate lines where the ID field is different?

Create a Totals query based on the table. Group By [Date] - which is a very
bad fieldname, by the way, since it's a reserved word - and by [Procedure].
Select the ID field into the query *three times*. On one select Count as the
Totals operator, and > 1 as the criterion (to select only those records with
duplicates); on the second use Min as the totals operator, and on the third
use Max. This will show you those records with duplicates and show the two
ID's. If there are triplicates or moreicates, you'll need a different query to
see all the ID's.

I presume that there are more fields involved here, surely - patientID or the
like? I'd expect that having the same procedure run (by a different doctor, on
a different patient) on the same date would be a very common occurance. If so
include these fields in the query and group by them too.

John W. Vinson [MVP]
.



Relevant Pages

  • Re: Deleting duplicate records/same table
    ... append the tblUniqueRecords fields into the fields on tblMaster. ... The new table without the duplicates is called ... Prepared By is the type of query I was ...
    (microsoft.public.access.queries)
  • Re: Query to delete duplicate records - but NOT original
    ... > unique records - I've already got an update query to grab the unique ... > hsc but one other field different - it ignores those 2. ... but this method of removing duplicates requires it. ... >> Access Database Samples: www.rogersaccesslibrary.com ...
    (microsoft.public.access.queries)
  • RE: Want to edit a table based on a query of a query of several qu
    ... First create union query like this -- ... Use that query in design view and add all of the other nine tables. ... This puts all the data in to a single query output without duplicates. ... Then I run a big query of all 9 queries to consolidate the data into one big ...
    (microsoft.public.access.queries)
  • Re: correct way to write the syntax for a Dlookup in a query expression in VB
    ... those that return false when the query runs to another table and leave ...    c) that you rewrite your sql select as a join checking for nulls ... DLookup; I am not). ... the duplicates may include differing information in particular ...
    (comp.databases.ms-access)
  • Re: Problem with delete duplicates query
    ... You might look at the Help topic called "Delete a group of records with a query". ... the final query to actually delete the records (the query based on the table and the query identifying the duplicates), I get a message that "Could not delete from specified tables". ... and then attach an Autonumber field to serve as the primary key and delete using that. ... FROM Table1 AS T1 ...
    (microsoft.public.access.queries)

Loading