Removing Duplicate Entries From Joined Tables In CrossTab Query?

Jun 19, 2007

Hello all,

I have made a crosstab query that is sporatically making duplicate counts. I'd like to know how to fix the problem, but more importantly - I'd like to know why and how my query is giving me these results so I can avoid making this same mistake again.

The relationship is set up so that all records from one table are returned, with only matching records from the other - so no problems that way as far as I can see. This is my crosstab query that is giving some counts of the same record as being matched sometimes two, three, or even four times:

TRANSFORM
Count([Testing DB].[DB_ID]) AS [CountOfDB_ID]

SELECT
[Testing DB].State, [Location].[North], Count([Testing DB].[DB_ID])
AS [Total Of DB_ID]

FROM [Testing DB] LEFT JOIN [Location] ON [Testing DB].[Address] = [Location].Address

WHERE (([Testing DB].[Window Length]) Is Not Null))

GROUP BY [Testing DB].State, [Location].[Size]

ORDER BY [Testing DB].State, [Location].[Size]

PIVOT Format([Date],"mmm-yyyy");

When I do a simple query for a list of the records being counted by this query, I can see the duplicate entries and can eliminate them simply by adding "Distinct" to the select statement - but I haven't had any luck adding any kind of distinction with this crosstab that will do the same.

How can I eliminate duplicate counts of records in my crosstab? If anyone has a suggestion, it would be much appreciated.

View Replies


ADVERTISEMENT

Tables :: Removing Duplicate Records From One Table

Feb 18, 2014

I have a table with at least 13.000.000 records. There are many duplicates records... For example

ID Name Family mobile car number chassis Register_Year
1 Roy Jalbout 9999 123456/G ASF4546 2005
2 Roy Jalbout 9999 854658/G GRK554JFJD 2009
3 Tony Elishah 1234 854658/G GRK554JFJD 2012
4 Sam Markos 5478 854658/G GRK554JFJD 2014
5 Roy Jalbout 9999 123456/G ASF4546 2005

As you can see ID Number 2,3,4 have the same car but every one bought from another so it's not duplicates

The duplicates here is the ID's number 1,5. So how to remove the duplicates. I remember you i have at least 13.000.000 records. I try to make a query to find duplicates then i make a copy of the original table and than i should make a primary key then append the data from the original table to the copy table, but here i have more than one criteria

When I made a query to find duplicates the result was 680.000 records and every one have a minimum 2 duplicates an maximum 4 duplicates so it's about 2.500.000 duplicates records at least....

View 5 Replies View Related

Queries :: Removing Duplicate Records In Query

Apr 24, 2014

Im trying to write a query that shows all the container movements. Yet when I run the query qryFullHistory I get a duplicate value for container Off Island. Ive tried adding some criteria that says that the DateRequested has to be between the ImportDate and ExportDate but that doesnt seem to work. There are duplicate entries for container Off Island in tblContainerDetails as the same container has arrived and left and then returned on another voyage. Yet there is no entry for the second voyage in the tblMEMRContainer.

A brief description of the tables is:
tblMEMR Movement requests details
tblMEMRContainers the containers that were moved on the movement request. There can be more than 1 container for each request.
tblContainerDetails details and dates for the container when it arrived and when it left

There are other tables but these are the 3 that are used in the query.

View 8 Replies View Related

Query Joined Tables

Jan 24, 2005

What I'm trying to accomplish is probably really simple that I just can't get it to work. I have set up the relationship properly, I think. Here is what it looks like:

tblProjects(ProjectID[PK],ProjectName, ProjectType, ProjectDate)
tblMembers(MemberID[PK], MemberName)
tblRoles(RoleID[PK], RoleName)
tblProjMemb(ProjMembID[PK], ProjectID[FK], MemberID[FK], RoleID[FK])

Each project will have three different member roles. Here is what I'm trying to get from my db:

myQuery(tblProjects.*, tblMembers.MemberID As Role1ID, tblMembers.MemberName As Role1, tblMembers.MemberID As Role2ID, tblMembers.MemberName As Role2, tblMembers.MemberID As Role3ID, tblMembers.MemberName As Role3)

I need Role1ID = Role1 If when tblProjMemb.RoleID = 1. I need to create a column for each of the three member roles and have the name of that person in that column.

I'm not sure how to accomplish this. Any help is much appreciated. Thanks!

View 1 Replies View Related

Tables :: Queue With Several Concurrent Entries - Reduce Duplicate Orders

Jan 24, 2013

I'm trying to create a database that is going to be used to deliver some work to several of our users. Each time they open a specific form they'll be delivered a job.

The tables are organized somewhat like this

tblQUEUE
PK_ID_Job(AUTO_NUMBER)| JOB_NUMBER(INT)|LOCKED(BOOL)

tblWorkOrders (FK_ID_JOB (INDEXED DUPLICATES ALLOWED))
FK_ID_Job(LONG)|Name(STR)|Date(DATE)|

Now it works like this, the user gets an ID_JOB from queue

In the form they get all the all the work orders with that ID_JOB, the thing is i'm getting users with same duplicate orders cause i can't update the locked efficiently.

Regarding the users, the database is split, multi-user, with >30 simultaneously

I'm been trying to use dao.recordset, with transactions to try and reduce the duplicate orders.

View 8 Replies View Related

Modules & VBA :: Code To Consolidate Two Tables And Remove Duplicate Entries

Oct 3, 2013

I have two tables in my Access database. Table 1 has three columns, First Name, Last Name and Phone Number. Table 2 has just 2 columns, First Name and Last Name. What I would like to do is write a VBA macro to consolidate Table 2 into Table 1 and insure any duplicate First Name-Last Name combination is removed.

Table1

Code:
F.Name L.Name Tel.N.
John Smith 12345
Larry Miller 12344
Tony Woods 12333

Table2

Code:
F.Name L.Name
Albert Black
Larry Miller
John Bush

Table1 Post-Macro

Code:
F.Name L.Name Tel.N.
John Smith 12345
Larry Miller 12344
Tony Woods 12333
Albert Black
John Bush

View 1 Replies View Related

Can't Add Data Into Fields In Joined Query/tables

Jan 17, 2006

I can not, or not allowed to enter data in fields in a query built from three tables that are jointed by a common field with the same name. The parent table is linked to another Access data base as is one child table the other is local data. Also, I am not able to view the child table data when viewing the parent table.

View 1 Replies View Related

Result In Query Not Showing Because Field Not Filled In (Joined Tables)

Apr 23, 2014

I have a query, that I have a criteria to show appointments in the past (< Date()) but one result doesn't show up although the appointment end date is a past date, it only shows up when I fill in a field that is in another table that is joined and part of the query. But there's no criteria there for it to not be null.

View 3 Replies View Related

Remove Duplicate Entries In Query Design

Oct 27, 2013

I am attempting to filter the data in query design such that it will not return anyone in the database has there name present more than one time.

For example, in the image below under the Owner_Name field there is "Abbot, Mark C Etux Wanda C". This name appears twice in the database. My criteria is the name can only appear once, therefore this record would not be returned after the query. In query design I would like it to return only name records that appear once in the entire database if there is a way to structure that.

View 1 Replies View Related

Removing Duplicate

Nov 20, 2007

I have a table that has mutliple records for the same person. I know how to create a query to remove duplicates but i don't know how to create a table to remove duplicates but keep the most recent record. Is this possible?


ie
client status date
123 A 1/1/07
123 C 2/5/06
123 A 9/3/07


results

client status date
123 A 9/3/07

View 3 Replies View Related

Tables :: Joined Two Tables - Unable To Filter / Lookup On Second Table?

Feb 18, 2013

I have an Access Table with about 28,000 Automobile dealerships across the country shown. I've joined a new/small phone contact table to this to keep up with our phone contacts with the dealership and followup efforts. When I search/filter on the dealership table all is fine. However when I search/filter on the phone contact table with a few test entries, I get nothing at all. I supposed that after joining the tables, I'd be able to do a search on the field named follow up date and find/filter today's date or other dates and locate which dealerships to contact when the correct date arrives. But nothing.

View 14 Replies View Related

Removing Duplicate Records... Help Please

Jan 3, 2008

Ok well I thought I was doing this right but it appears I have not. I am drawing data from two tables. Both of them related by the person's name. One table I am pulling the unique ID number, the other table contains the name. I have a PO (Purchase Order) field being pulled from the table that holds unique ID. Or lack there of, so I am pulling all the records that contain no PO number. However duplicate unique ID's are being pulled. The way my query is set up now is:

Unique ID Number
Name
Count (Number of Procedures)
Charges
PO Number - Criteria: "Is Null"

I have also right click in the table view area, in the properties I selected Unique values. I have to assume that this would have held back any Dupes from the output. However this is not the case. When I looked in the help files the only thing I could find was:

http://office.microsoft.com/en-us/a...0840151033.aspx
Quote: "If you want to see only unique values in a result set, you can specify that you want to exclude duplicates from the result set.

In the Database window, click Queries under Objects, click the query you want to open, and then click Design on the database window toolbar.
Right-click the background of the Diagram pane, then choose Properties from the shortcut menu.
Select DISTINCT values.
The Query Designer inserts the keyword DISTINCT in front of the list of display columns in the SQL statement.

Note If you use the DISTINCT keyword in Microsoft SQL Server, you cannot modify the data in datasheet view."

The problem with this is my properties box does not offer a Distinct Values option. So my question is. Is there an expression I can place in the Unique ID field that will exclude any duplicate records.

Sorry for the book
Sean

View 3 Replies View Related

Queries :: Removing Duplicate Records

Jul 23, 2015

I'm having a problem removing duplicate records from a table. It should be easy but I can't suss it.This is an example of the data in my table:

Code:

RefDateStatus
113007111/06/2015Do Not Pay
114454306/07/2015Do Not Pay
115760714/05/2015Do Not Pay
116520705/05/2015Do Not Pay
117670108/05/2015Do Not Pay
118036218/05/2015Do Not Pay
118517015/05/2015Do Not Pay
178734020/07/2015Do Not Pay
182809915/07/2015Do Not Pay
184226010/07/2015Payment Due
184226022/07/2015Payment Query

As you can see, there are 11 records here but the last two records have the same reference number. I need my query to show the first 9 records + the record from the bottom two with the latest date (22/07/2015).

View 2 Replies View Related

Removing Duplicate Records With Macros

May 8, 2013

I currentlyt have a search form that searches criteria based on a textbox. After entering data a macro runs, and opens up a query with the results. After that query opens i have macro that runs a duplicate query off of the query initally opened based on the search results. What i would like to have is a macro that removes the duplicate records from the duplicate query and display the remaining records.

View 1 Replies View Related

Order By When You Have Joined Tables

Jun 27, 2005

If I use order by on a query that has two linked tables I keep getting an error:
This is the query
SELECT d.PDetailsID, d.po_id, d.po_uniqid, d.job_id,
d.p_qnty, d.p_desc, d.p_unitp, d.p_units,
d.p_extend, d.p_qos, d.p_grec, d.p_done,
d.cocreq, d.est_id, d.line, d.class,
d.selected, d.itemid, d.category, d.GroupID,
d.p_qosextended, d.late, d.lastsavedby, d.matid,
d.customer, SQLACCESS.tblctpur_d.jobid, d.DTime, d.Notes,
d.DescDetails, h.pur_ddue
FROM SQLACCESS.tblctpur_h as h INNER JOIN
SQLACCESS.tblctpur_d as d ON h.pur_id = d.po_id
ORDER BY d.line

The error is :
The colum prefix d does not match with a table or alias used in the query

View 8 Replies View Related

Can't Add New Records When Tables Are Joined

Apr 18, 2005

I have two tables in my database
Agents
Zip Codes (linked table)

If I create a query and then a form off the query that includes fields from both tables - Access will not let me add new records.

Ultimatley what I am looking to do is have a zip code field in the Agents table that I fill in and then it will automatically look at the zip codes table and then fill in the zip code, county, & state in a different area of the form.

I tried using fields from both tables and tried a query using fields from both tables and it will not let me add new records.
I have a relationship between the fields in both tables.

What am I doing wrong. I know this can be done.

Any help would be great!!!

View 2 Replies View Related

Issue With PDF Report From Joined Tables

Nov 11, 2007

Hi,

I have problem with pdf-ing a report that has record source coming from a query namely from the two tables joined based on the same of several fields (foreign keys).

I have PDF coding that would turn Access report to PDF report. It has no problem when the report's record source is from one table only.

Just wonder if anyone who might have a similar issue would like to share with me some help. Is it normal that PDF doesn't work if the report comes from joined tables in Access?

Thank you in advance

View 3 Replies View Related

Deleting Rows From Joined Tables

Jun 5, 2006

I am using the following query to identify rows in one table that have no match in another:

SELECT MAS.MASID
FROM MAS LEFT JOIN IVT ON MAS.Field1=IVT.Field1
WHERE ((IVT.IVTID) Is Null);


MAS is one file with MASID as the key.
IVT is the other file with IVTID as the key

This provides me a list of the rows in MAS with no match in IVT.

I now want to delete these rows in MAS so we can process the other fields in the table.

what is the syntax for the delete statement? I can't get the join to fit in correctly.

Help!

View 2 Replies View Related

Get Information From A Few Tables Joined Not Working....

Nov 28, 2007

Hi,

I am getting information on products stored in a query. I want that query to check a couple tables to see if an item is linked through all of them. If it is not listed in the last table (catalog) I want it to be shown.

Code:Catalog tableVolume Prefixprodno Price15 - CE 0218 9.9915 - CE 0722 3.7215 - CF 0218 12.3615 - CF 0091 14.00Source TableSource MediaCM70904 15 - CE

Code:Batches QueryCustomer Number Prefixprodno Source716933 0218 CM70904716933 0408 CM70904

This is the Select Statement I'm using, which gets the 0218 but not the 0408 I want

Code:SELECT (fieldnames......)FROM [Batches] INNER JOIN ([Source] INNER JOIN [Catalog] ON [Source].[Media] = [Catalog].Volume) ON ([Batches].Source = [Source].[Source]) AND ([Batches].Prefixprodno IN ([Catalog].Prefixprodno))WHERE [Batches].[Customer Number]=716933;

If I do NOT IN I get both 0218 and 0408. I just want 0408. I'm sorry if this seems confusing but any help would be amazing at this point =/

View 3 Replies View Related

Queries :: SELECT DISTINCT Not Removing Duplicate Records In Staging Table

Jan 29, 2015

I have a database with an import process which normalises incoming data and appends to various tables. No issues with that. I also have a function within that process which counts the number of new entries for a summary popup when the process has completed.This works by querying the staging table, prior to the append, into a recordset and using the .RecordCount to increment the count (multiple files can be imported at once so this effectively provides a running count, per file, to give a total for the whole import)

I thought it was working fine but this morning I noticed that the count which appeared on the popup was 1 greater than the number of actual new records. I checked the source files and noticed that, for whatever reason, there was a duplicate entry in there. So I presume that's why the count was out by 1.

There's no integrity issue in the main tables as the composite primary keys ensure that duplication shouldn't be a problem. Indeed, the record in question, duplicated in the source, appears only once in the main table post-import. So not too worried about that.

However, I need the count in the popup to be accurate (it tells the users how many new entries require further investugation). And what's puzzling me is that I use DISTINCT in the query, which I would have thought should eliminate any potential dupes in the recordset and thus provide the correct count. It seems it doesn't?

Code:
Public lngNewBalancesTBI As Long ' Defined in a separate module...
-------
Dim dbs As Database
Dim rst As Recordset
Dim strSQL As String

[code]....

Why the dupe, which is still present in the staging table, also makes it over to the recordset, even though I'm using DISTINCT?

View 14 Replies View Related

Reports :: Joined Tables - Returning Multiple Records

Apr 10, 2014

I a report based on query based on joined tables. Im using FK and PK accordingly in the tables and have a junction table.

I've attached a sample (removed all unique identifiers for privacy in case you're wondering).

Table structure as follows:

Employees tbl - Junction (License Link tbl) License No tbl, License Class tbl, Endorsements tbl

So the query runs on all of these tables.

When I build a report on the query, Simon shows up Six times. I suspect because he has six endorsements.

How do I produce a report on this table/query structure so that I get:

Simon.
Class, 1,2,3,4,5
Endorsement F,R,T,W,DG

View 1 Replies View Related

Create Access Form With Having Joined Tables Fields

May 14, 2013

I have at least 3 relates tables in my access database.the first(sessions) table stores session detailes like id,date,time

The second one (tblemployees) contains our employees details like name, idp ,the third (attreq) relates the first table to second it stores ids of sessions and ids of personals that which determine which personals have attended in special sessions.

Now,my problem is that I want when a personnel log in and opens "confirmed session"form ,the access check and open records that this person have attended. How can I do it?

View 3 Replies View Related

Duplicate Entries

Mar 30, 2006

hello,
Currently i have a database that holds information about computers. Each computer has a Service tag and is associated to a person. I need to be able to prevent duplicate service tags from being entered. I am using indexing and don't allow duplicates from the table design view. But, if a duplicate service tag is indeed entered, i want to inform the user who that service tag currently belongs too without having to search through the DB manually. I need then to give the user the option to delete the duplicated record they just entered or change the service tag that they just entered. Thanks.
Jared

View 2 Replies View Related

Prevent Duplicate Entries

Oct 25, 2006

I've set up a booking system and am looking to stop the system recording double bookings.

I've 3 fields, RoomID, Date and Time that need to be searched, however I can't just simply set the properties to No Duplicates (as this would mean a booking cannot be made on the same day at 9:00 and 12:00 for example).

How can I do this?

View 9 Replies View Related

Preventing Duplicate Entries.

Nov 26, 2006

Hi again, thanks to all for the help given so far.

Is there anyway (other than making that field a primary key) to prevent the same value being entered into a different record?

E.g.

If under 'Name' Radion has already been written, I want an error message coming up saying there is already a record with radion.

View 3 Replies View Related

Finding Duplicate Entries

Oct 12, 2006

I am running a query to find out duplicate in two fields in one table. Postcode and Address Line 1. Can anyone tell me the formula for only picking up the first 6 charaters in the Address Line 1 field??? I cant remember how to do it!

HELP!

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved