Query Duplicate Question

Jun 27, 2007

Okay you'll read this and think this is a really dumb question but bear with me please! I have a table with about 100k records. There is a field called "SN" and this feild is unique to it self. Although it is not a unique record in the table, this is because "SN" is count EVERY time it passes through a specific location. So for example say your car "SN" is 4545, and you drive through PA, then NY, then NJ. This table will count each event this happens. Then say this car makes the same trip through PA, NY, NJ so again the table will count 4545 for "SN". What I need to do is query only the duplicated so I can get rid of of all of them but 1. Sorry if this is confusing.

View Replies


ADVERTISEMENT

Forms :: Prevent Duplicate Values With Alert After User Enters Duplicate Value

Dec 30, 2013

We are working on an Access (2007) database that is on a SharePoint Site (2007).

Currently the form is operational, but there is one last thing that would be nice to have.

The table is "Updated Headcount" which contains "EMP_ID" which are unique numbers stored as text.

In the event a new employee is entered in the system by another user on this site we would like to prevent any duplicate "EMPID"s from being entered and saved on the SharePoint, we would also like to alert the user and prevent the data from being saved.

All data is currently bound, so once the user makes a change it is made, no submit button is required.

We are running into some difficulties in doing a dlookup from the value entered and comparing to a column in the table.

TABLE - UPDATED HEADCOUNT
COLUMN in UPDATED HEADCOUNT - EMPID
FORM CELL user will input an EMPID - newEMPID
FORM CELL used for a dlookup to compare what user has entered to what is already in the table - duplicateEMPID

So below is what we are trying to do, we are sure there are a few commands missing....

=IIF(newEMPID=dlookup([UPDATED HEADCOUNT]![EMPID]), newEMPID, "Error, EMPID already exists")

View 11 Replies View Related

Duplicate's Query

Oct 24, 2006

I need to make a query that will return all records that have the same field (ex. street address)

how can i do this?
for instance

1|123 street
2|123 street
3|444 block
4|444 block
5|839 town


the query should return:
1|123 street
2|123 street
3|444 block
4|444 block

View 1 Replies View Related

Eliminating Duplicate On A Query

Sep 6, 2005

I have a query for clients who come to our office looking for services.
I only need to report 1 visit per client during the month, in other words if the client comes several times during the month, we only count 1.

When I run the query, it gives all the times the client came to the office, but I only need to show once.

Clients are being sorted by ClientID. What do I need to write in the Criteria field to filter clients from showing again ?

Thanks

View 5 Replies View Related

Duplicate Results In Query

Jun 25, 2007

I am using a database created by someone else, so I don't know if this is a table issue or a query issue. I create my query pulling information from an established table, and I get duplicate results. The database is intended for use as a timecard where all of our employees can record their time and we can track the projects that they are working on. So, what I mean by duplicate results is that we have tasks and subtasks for the time card and for each entry, when I pull it up in the query, it is duplicated for each task. In other words, if there are nine different tasks in the table and the subtask is "robotic testing", it will be repeated with all of the nine tasks. Like I said, I don't know if it is the table that has a problem, or if it is me. I am a super beginner and I don't know much at all about access. Please simplify your answers. Thanks!

View 1 Replies View Related

Query For Duplicate Records

Jul 9, 2007

I am creating an ordering system which comprises of amongst others, these fields:

ID
OrderHdr
OrderLine

I want to ensure that if a user enters an ID, OrderHdr and OrderLine that this combination does not already exist elsewhere within the same table.

I have written a query like this:

COUNT OrderLineDetails.id, OrderLineDetails.orderno, OrderLineDetails.orderline
FROM OrderLineDetails
WHERE (((OrderLineDetails.id)=?) AND ((OrderLineDetails.orderno)=?) AND ((OrderLineDetails.orderline)<>?));

I will be replacing the "?" with the relevant form fields from the form, but how do I run the query and store the result in a variable and prevent the user from carrying on until they change any of the fields until there is no duplication.

View 3 Replies View Related

Duplicate Query, (sort Of)

Oct 11, 2007

I need to create a query for an error report.

What I need is a query that will find any duplicate records from field '1' in my table.

But then I want it to check another field '2' in the same table for any records that meet criteria 'A' but also have entries with a different critiera.


Not sure if I'm explaining that right.

So say we have a table like this

field 1..........field 2
XX.................A (the criteria we want)
XX.................C (oops, somone entered another entry with a different criteria)


So it would tell us that the 'code' in field 1, we have the criteria A and C at the same time. not good.

I hope that makes sense.

View 14 Replies View Related

Keep Duplicate Values In Query

Aug 27, 2015

I've got a query where a particular field can have duplicate entries. I do NOT want to limit the properties to only have unique values. On the contrary, I very much WANT to keep those but I DO want to have something indicating that the duplicates are there. I can create another Y/N or true/false field to indicate this if needed.

View 1 Replies View Related

Help Filtering Duplicate Records From Query

Nov 28, 2007

Dear Experts,
I have created a database with queries that is working fine, however there are many records that have the same information that can not be removed easily, is there a method anyone knows of that can filter the records produced from a query to remove duplicates? i.e. 'select distinct' but for the whole query after the search parameters have been entered.

e.g. the search query is producing, after the refined search values are entered:
414353p - Fiat - 1.6 - MLS
414353p - Fiat - 1.6 - MLS
How can i then apply a filter to automatically reduce these duplicates to just one entry for the whole form?

Thanks

View 6 Replies View Related

How To Delete Duplicate Record In Query?

Sep 1, 2005

Hi,
I have table tblSample (IdNo, SCode, StaffNo) where IdNo is AutoNumber. This is sample of data,

IdNo SCode StaffNo
10 ABC 50424
11 DEF 50424
12 GHI 50424
21 ABC 50424
22 DEF 50424
23 GHI 50424
26 ABC 50424
27 DEF 50424
28 GHI 50424

Is it possible for me to delete records from IdNo 21-23 and IdNo from IdNo 26-28. Any idea? Thanx in advance..;)

View 1 Replies View Related

Blank Or Duplicate Return From Query?

Apr 21, 2006

I have searched for an answer and spent some hours but still not getting it.

I have played about with the query joins and still nothing?

I have never had this problem with my database in 5 years (well not that i have noticed).
Some records are fine others are triplicated and quite a lot are blank?

This is the SQL for the query.

SELECT Employee.EmployeeID, Employee.FirstName, Employee.Surname, Employee.Address, Employee.[Town/City], Employee.Region, Employee.DateofBirth, Employee.Nationality, Employee.MaritalStatus, Employee.PassportNo, Employee.ExpiryDate, Employee.Nextofkin, Employee.Relationship, Employee.NOKAddress, Employee.ContactNo, Certificate.CertName, EmployeeCert.Level, Trade.TradeName
FROM Certificate INNER JOIN (Trade INNER JOIN ((Employee INNER JOIN EmployeeCert ON Employee.EmployeeID = EmployeeCert.EmployeeID) INNER JOIN EmpTrade ON Employee.EmployeeID = EmpTrade.EmployeeID) ON Trade.TradeID = EmpTrade.TradeID) ON Certificate.CertID = EmployeeCert.CertID
WHERE (((Employee.EmployeeID)=[Forms]![Employee]![EmployeeID]) AND ((Certificate.CertName)="IRATA"));

Basically i have to solve this problem.

I have a report that is based on this query and if the employee is not displayed correctly instead of the employees Name and Surname i am getting "#Error" ?

Many thanks in advance

View 1 Replies View Related

Eliminate Duplicate Records In A Query

Jun 5, 2007

I know there a many posts about eliminating duplicate records because I did search, but I did not see anything that really answers my question.

I have a query in a local Access database that is using a Linked table from an SQL database managed by our corporate IT department. I have read access to only certain tables / fields in the SQL database. My query is based on 3 tables from the database and I have them linked together in my query.

When managers move from one site to another, they are given a different TeamID number. However, until they are replaced, the manager will have more than one TeamID assigned to him in the SQL database. Evidentally, the way our IT has the SQL database structured, when I query open items it duplicates the record for that manager because he has 2 TeamID numbers. So the only field that comes up differnt in the duplicate records is the manager's TeamID number.

I would like for my Select Query to ignore the duplicate record. I know I can use an Append Query to copy the data temporarily to a local table and set the proper fields as Primary Keys to do this. However, it would be nice if I did not have to go to all that trouble.

Is there a way to eliminate duplicate in my Select Query?

As always, I appreciate the help.

Jim

View 2 Replies View Related

Allowing Duplicate Data In A Query

Jun 13, 2007

I have a database that allows multiple entrys of the same information. I also have a report based on a query that pulls out said data.

I just need my query to pull out every record regardless if it is indentical to a previous one. I found under queries > design > properties there are two options unique values and unique records. According to a source online, these are what control allowing duplicates through, but I have swapped them around with no luck. Currently they are both set to "no".

Is there some other setting I have to switch up in order to allow the duplicates to come through?

Thanks

View 1 Replies View Related

Queries :: Query Duplicate / Replacements Are More Than 1

Aug 14, 2013

I have a database which holds information about repairs. Each repair is called a task and among other things data is held about things(s) that caused the failure and what need to be replaced. Usually it's one fault but it could be many.Replacements are usually more than 1. Bottom line, in a simplistic view, I have 3 tables task, fails and replacements. There is one to many relationship between tasks and fails and also a one to many relationship between tasks and replacements.

If there is one fail and many replacements my query is good enough as it will produce

task1 fail1 replace1
task1 fail1 replace2
task1 fail1 replace3

On the report I can hide duplicates to get the desired (. = space!!)

task1 fail1 replace1
...............replace2
...............replace3

Problem occurs when I get more than 1 fail. Query returns

task1 fail1 replace1
task1 fail1 replace2
task1 fail1 replace3
task1 fail2 replace1
task1 fail2 replace2
task1 fail2 replace3

Hiding duplicates I get

task1 fail1 replace1
...............replace2
...............replace3
.........fail2 replace1
...............replace2
...............replace3

whereas I'd like to get

task1 fail1/fail2 replace1
.....................replace2
.....................replace3

or something similar.

View 14 Replies View Related

Queries :: Query Shows Duplicate

Dec 4, 2014

I hve a query that I want to total soldAtPrice *quantity This information is stored in my order details table and mus not change .I can do a calculated field to get the answer but the Problem is if there are 2 recodrs to be totaled the query displays 2 records if there are 3 records the query dislplays 3 records and so on .I need one record to be displayed with the total of all the recodrs

View 3 Replies View Related

Queries :: Inserting With Duplicate Key Query

May 19, 2013

I have a load of data in an excel spread sheet that I'm trying to put into an access using Excel VBA (Jet/ACE SQL I think!?). I do this by constructing INSERT INTO strings and looping through my spread sheet. Let's say the primary key is associated with the field [Company] which holds the company names. A simplified version of what I was using (it all works great ) is below:

Code:
Set rs = New ADODB.Recordset
Set cn = New ADODB.Connection
cn.ConnectionString = GetConnectionString()
cn.Open
cn.Execute strSQL

where strSQL =

Code:
INSERT INTO tblTestMDB ([Company], [Date])
VALUES ('BP', '30/09/2012')

Unfortunately, I am having issues with users adding the same company twice. I'd like it to:

- update the existing company info if the company already exists
- add the company if it is not already there.

I'm trying to do it in two stages. First an update, then an add. The first part works great :

Code:
UPDATE tblTestMDB
SET [Date]='21/03/2015'
WHERE [Company]='BP';

The second part: (I have tried numerous variations on the syntax):

Code:
INSERT INTO tblTestMDB ([Company], [Date])
VALUES ('BP', '30/09/2012')
WHERE NOT EXISTS (SELECT * FROM tblTestMDB WHERE [Company] = 'BP');

I find the error messages rather cryptic but they include things like "Query input must contain at least one table or query." or "Missing semicolon ( ; ) at end of SQL statement." (<== No I'm not!?

View 2 Replies View Related

How To Sum Duplicate Records In Union Query

Oct 30, 2012

(Example of my data)

Order ID Customer ID Purchase Amount
1 17 $14.95
1 17 $7.35
2 21 $11.90
3 27 $64.80
3 27 $31.13

I have two tables with pull in data. What I'm looking for is a query that would combine the customers purchase and sum the purchase amount field. The tables are unioned as some customer data is in one table but not the other and joining them excludes some of this data. Ultimately I would like to see is

Order ID Customer ID Purchase Amount
1 17 $22.30
2 21 $11.90
3 27 $95.93

View 1 Replies View Related

Filtering Duplicate Records Query Problem

Jul 19, 2006

1 table contains the records I needs to be queried.
The result Im looking for is to view all the clients that have a different advisor assigned to a duplicated ssn. - not same advisors assigned to a duplicated ssn.
Example of desired outcome.
ssn name advisor plan
111223333 joe smith john doe b
111223333 joe smith jane sony c
111223333 joe smith unknown a

I am getting all data.
ssn name advisor plan
111223330 Jack Jack john doe b
111223330 Jack Jack john doe c
111223330 Jack Jack john doe a

Ive tried query with using 'first' for the ssn and the advisor still give me all data.
Please help me....
Thanks

View 3 Replies View Related

Union All Query NOT Displaying Duplicate Records

Dec 10, 2007

I have two tables, and I made a union query (tbl1 UNION ALL SELECT ...tbl2). Problem is, I have two entries that are identical in both tbl1 and tbl2, but I want to include BOTH of them in the union query. Even though I used the ALL operator, only one set shows up!! I'm pulling out my hair trying to figure this out. Please help, and thanks so much in advance!:(

View 2 Replies View Related

Form To Open When Query Picks Up Duplicate

Sep 5, 2006

Hi all

I have a form (DuplicateSpot) with a subform whos record source is a duplicate check query. The query checks to see if more than 1 person is assigned to the same spot for a given date. I want the DuplicateSpot form to open when the query picks up a duplicate. This will be part of an On Click event for a button. I'm just unsure of what kind of code I need to go about doing this.

If this explanation is unclear, please let me know.

Thanks!
ScrmingWhisprs

View 1 Replies View Related

Queries :: Duplicate Count From Group By Query

Jul 17, 2014

I'm trying to count the number of records within a region range using a lookup table however I keep getting duplicate values, SQL code, what is happening:

SELECT Count([summary].Key) AS CountKey
FROM Summary, lookup
WHERE ([Region])) Between [Region 1] And [Region 2]));

View 4 Replies View Related

Queries :: Hide Duplicate Record Using Query

May 18, 2015

I have a question on hiding duplication record using query.

The fields in the query are:

full name(trainee), NRIC(trainee), gender(trainee), preferred language(trainee), company(trainee), course name(course), course date(course), competent(course), class(course), L3 survey(trainee), L4 survey(trainee), num of month(course)

When the query is being run, it will show all the people that have not done the L3 and L4 survey after 3 month. The the query will be convert into a form. However the problem is that the record will show a few same name due to one person can take more than 1 course. therefore, the data in the course table will always be different.

How can i make the record only show 1 name even though they have different course name.

I had tried putting 'yes' for unique record and unique value but it did not change the result.

current SQL query:

SELECT DISTINCT trainee.[Full Name], trainee.NRIC, trainee.Gender, trainee.[Preferred Language], trainee.Company, course.[Course Name], course.[Course Date], course.Competent, course.Class, trainee.[L3 survey], trainee.[L4 survey], DateDiff('m',[Course Date],Date()) AS [Num of Month]
FROM trainee INNER JOIN course ON trainee.NRIC = course.NRIC
WHERE (((course.Competent)="c") AND ((trainee.[L3 survey])=False) AND ((DateDiff('m',[Course Date],Date()))>=3)) OR (((trainee.[L4 survey])=False) AND ((DateDiff('m',[Course Date],Date()))>=6));

View 6 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

Queries :: Custom Delete And Duplicate Query

Jun 12, 2013

I am trying to create a query to find duplicates and delete the duplicates. The result will eventually be used in another query (append query) to update a table.I have a table with 4 columns lets say for simplicity they are A, B, C, D

I want my query to find duplicates within B and deleting them. The catch is before deleting them I need to look into column A to ebsure they are actually duplicates. Example below

Example
A B
John Doe Tires
John Doe Wipers
Allison Doe Tires
Allison Doe Tires

As you can see from the above Tires is a duplicate and need to be deleted.

A B
John Doe Tires
John Doe Wipers
Allison Doe Tires

View 7 Replies View Related

Queries :: How To Manipulate Find Duplicate Query

Jun 15, 2013

I am trying to manipulate a find duplicates query using the following criteria:

Fstnm L2, Lstnm L5, Add1, Zip

This is what I have done so far:

SELECT [Duplicate Identification Dataset].[FSTNM], [Duplicate Identification Dataset].[LSTNM],
[Duplicate Identification Dataset].[ADD1], [Duplicate Identification Dataset].[ZIP],
[Duplicate Identification Dataset].[ID], [Duplicate Identification Dataset].[MIDNM],
[Duplicate Identification Dataset].[SPFSTNM], [Duplicate Identification Dataset].[SPMIDNM],

[Code] .....

View 1 Replies View Related

Queries :: Duplicate Results For Some Of Records In A Query

Dec 3, 2013

Why I am getting duplicate results for some of my records in a query. I have unique values set to Yes. I have also validated that the tables I am using don't have duplicate data. SQL is below.

SELECT DISTINCT [tbl_Rewards Activity Report - By Member Number].[Member Number],
[tbl_Rewards Activity Report - By Member Number].[Last Four],
[tbl_Rewards Activity Report - By Member Number].[BAL ID],
[tbl_Rewards Activity Report - By Member Number].[Primary Name],

[Code] .....

View 1 Replies View Related







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