Eliminating Duplicates From A Query Pull

Nov 3, 2004

Hello,

I am building a query that pulls from one databases but I am running into duplicates.



Here is the skinny:



From the [tbl_databases], I am setting criteria that restricts a column containing “Visio”, more specifically, “Not Like “*Visio*”. I am also setting criteria that restricts a column containing “OLD” (it is a Yes/No field).

.

The problem is that there are duplicate rows that contain both “Visio” and “Old. So, simply suing my criteria restriction are pulling out the Visio and Visio/Old orders as well as Old and Old/Visio order.



Can I create a subquery that contain the combination of “Visio” and “Old” to restrict the subset from being extracted twice?



I think I have the logic but not sure not to set it up.



Thanks

Tuktuk

View Replies


ADVERTISEMENT

Eliminating Duplicates In AQuery

Jan 23, 2007

I have created a query which gives me a COUNT for a field type GROUP:
SELECT AllPairAssignmentsQ.COID, Count(AllPairAssignmentsQ.COID) AS CountOfCOID
FROM AllPairAssignmentsQ
GROUP BY AllPairAssignmentsQ.COID;

AllPairAssignmentsQ is based on a union query of 5 tables. The problem I am having is that I am getting some duplicates which I need to eliminate. Each listing contains several fields. However their are two fields in the query which can be used to determine that entries are duplicated. If the combination of MAINCOUNT and COID are identical in an entry then only one of the listings needs to be counted.

The following is an example of my problem:
MAINCOUNT COID
1201 HNVL
1202 HNVL
1203 HNVL
1203 HNVL
1203 COAC
1204 COAC

My existing query will return the following:
COID COUNT
HNVL 4
COAC 2

Since 1203 HNVL is duplicated I would like for the query to count only one entry so that the query returns the following:
COID COUNT
HNVL 3
COAC 2

Thanks for any help that can be provided in solving this problem

View 8 Replies View Related

Eliminating Duplicates In A Grouped Report

Aug 23, 2006

OK, first time posting so I'll try to be clear here. I work for a special education agency and have created a database to track student/therapist information. Now, I have reports showing which kids are in which schools and who their therapists are. What I can't figure out is how to print a report, grouped by school, that will display which therapists are active in that school.... any ideas?

View 1 Replies View Related

Summing Data While Eliminating Duplicates?

Jul 2, 2014

what I am trying to do with that table is get a sum of all assets, a sum of all Customers, and a sum of all Employees only counting each Comp ID once. Each company that we deal with carries multiple of our products. So as you can see I currently have it in the table where it shows the different data for each product over 2011, 2012, and 2013. Obviously for this I cannot just sum the entire column, as I would have the same company summed multiple times. The thing that is making this challenging for me is that I need it summed for each individual year (2011, 2012, 2013), with the end result being a total number of employees, assets, and customers.

I was thinking that to do this I would need a Sumif formula with several other formulas inside of it, but cannot figure out what exactly I would need to do. I know that if I took it into excel I would be able to do it, but we have over 7000 different customers, each having anywhere from 3-20 different products, and for each of the years 2011-2013... so the data is just too massive to try to convert and manipulate in excel.

The reason that I am hoping to get a count of their customers, assets, and employees is so that we could then take the info from individual customers and find out that particular customer's portion of the total assets, customers, or employees. I guess the mock table that I made doesn't keep the formatting when I add spaces, so imagine that each pair of l l is a column and match that with the columns above.

I also need another column that has the 2012 and 2013 results

l Comp ID l Year l Prod Fam l Prod Group l Prod Code l Assets l Customers l Employees l Assets for 2011 l Customers for 2011 l Employees for 2011 l
l 1101232 l 2011 l Family A l Group A l Prod A l 59000 l 33 l 28 l
l 1101232 l 2012 l Family A l Group A l Prod A l 55000 l 36 l 23 l
l 1101232 l 2013 l Family A l Group A l Prod A l 51000 l 39 l 25 l
l 1101232 l 2011 l Family A l Group C l Prod B l 59000 l 33 l 28 l
l 1101232 l 2012 l Family A l Group C l Prod B l 55000 l 36 l 23 l
l 1101232 l 2013 l Family A l Group C l Prod B l 51000 l 39 l 25 l
l 1101232 l 2011 l Family B l Group B l Prod C l 59000 l 33 l 28 l

[code]....

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

Eliminating Duplicate Rows In A Query Result Based On One Column

Apr 22, 2014

I have a query based on 2 tables, joined on Memberid, the result showing :

Table1 Table1 Table1 Table2 Table 2 Table2
Category Association Memberid CustomerName E-mailAddress MemberID

Board Member(Lookup,integer) SAMGA(Lookup,integer) 44 Smith smith@abc.co.za 44
Board Member ADHTY 44 Smith smith@abc.co.za 44
Grower SAMGA 44 Smith smith@abc.co.za 44

I only want to show 1 row, based on the duplication of E-mail address. I know i should be using the row_number function, but cannot get to the result I want.

View 4 Replies View Related

Eliminating $0.00 In Field

Feb 29, 2008

I am have trouble eliminating the $0.00 balances in a query. From what I can figure out is that even though the Balance appears as $0.00 in reality it could be anywhere from $0.0012 to $0.009 or something like that.

What I am trying to do re reconcile the Balance field. If the balance reads $0.00 I want it out of the query. Then I would like to find all the balances that appear to be $0.01 to a negative $0.01.

It seem that no matter what is use as critiera I still can't what I want.

Any ideas?

View 3 Replies View Related

Pull Down Menu In Query

May 22, 2006

I would like to build a query and ask it to choose a boat name out of a list of pre set names. When the pop up box appears to type the name, i would like it to be a combo box where the name can be pulled from the list. can this be done? thanks in advance.

- Andre'

View 1 Replies View Related

Pull Down Query List

Nov 1, 2006

I was wondering was it possible to have my queries in a pull down list and I hit a button and the query/report is ran? Or do I have to stay with about 6 or 7 buttons on a form?


I know it sounds crazy.....

View 2 Replies View Related

Query To Pull First & Last Record?

Jan 4, 2007

I am having trouble. I have a log table and I am trying to pull two records at once. The records im trying to pull is the most recent record update as well as the original record.

Example:

I want to pull for Toysrus the first log intry for this company when I first put the record in. And I want to pull the most recent update that I did for this company. Is there a way to pull both records at the same time? The first and the last?

Any help would be appreciated. THANK YOU SO MUCH!!!!!

View 2 Replies View Related

Eliminating Several Queries That Do The Same Thing?

Jan 3, 2007

I have many queries that all do the same thing. The problem is that they're connected to specific controls on a form, so I have to make a new query everytime I make a new form to perform the same task as the others. This would be eliminated if there was a way to use the criteria the same way you would in code, like Me!controlname. Is there anyway possible to make these queries more universal so that they can be used by many forms?

View 1 Replies View Related

Eliminating Redundant Records

May 21, 2007

Dear All,

I have a table with several fields.

Concentrating only on few fields I'd like to sort out redundant information (unnecessary records).

(It is similar to using Ecxel: Data>Filter>Advanced filter>Unique records only)

So, I'd like to ask for your help how can I reduce my table to unique records.

thx

Csaba

View 5 Replies View Related

Find Duplicates And Create Table With Dates Of Duplicates

Feb 12, 2008

Hi this is my first post... so hi all :)

ok what i have is a table with contact details 900k plus

there are about 90k of which are duplicates.

this is the basic feilds that are important in this case.

Id, data_source, data_recived, data_code,

what i want is to have a table with unique records (no dups in data_code)

this table will look like this...

Id, data_code, Num_dups, dup1_source, dup1_date, daysbtw_Dup1_dup2, dup2_source, dup2_date, daysbtw_Dup2_dup3 ,dup3_source, dup3_date, daysbtw_Dup3_dup4 ,dup4_source, dup4_date,

I know there is no more than 4 dups of each record.

what i want from this is a table that will give me a record of how many dups for each record then all the dates that they were added and the date between each record entry.

if anyone can help it would be great .

thanks in advance.

View 6 Replies View Related

Query To Pull Past 3 Months

May 22, 2007

I have a query that I need to always pull data from the newest past 3 months, so if this query were ran today it would take from months 2,3,4 (Feb, Mar, Apr). Any clue on how to do this?

View 14 Replies View Related

Query Updates Pull Down Menu

May 5, 2006

Greetings,
I have a table with the following 2 fields: Make and Model.
When I am in data sheet view I have Make set up as a pull down menu with the various distinct options (i.e. Ford, Chevy, Toyota, etc.). I would like to set up the table so that when I click on Ford, for instance, it will query a different table (carclass) and output only the Ford vehicles on a drop down menu for the Make field to choose from. (i.e. Mustang, Freestar, Focus, etc.)
For Model, I have the following code for the Row Source:

select model from carclass where make=make(from the user input of the make).

Any help or suggestions would be greatly appreciated.
Thank you in advance for your assistance.
Cheers.
John

View 2 Replies View Related

How Do I Pull Subform Data To A Query?

Sep 26, 2007

Hello,

I have a form with a subform. I have the subform running a update query on a command button in the subform. The subform has the textboxes and I cant seem to get the query to pull the data from those textboxes. I have used the normal [forms]![form_name]![textbox_name] in the past but everything I try to pull the subform textbox data is not working.

I have tried
[forms]![form_name]![subform_name]![textbox_name]
[forms]![form_name]![subform_name].[form]![textbox_name]
[forms]![form_name]![subform_name].[form].[textbox_name]

Nothing works. What is the correct syntax for this? Any help would be great !!! Thank you in advance.

Joe

View 2 Replies View Related

Possible To Pull A Query Into Form Design?

Jul 4, 2014

Is there a way to pull data into my form so that I can see current stats about my table in the same box as where I'm entering new data?

View 7 Replies View Related

Eliminating Spaces In Data Entered

Jun 28, 2005

I have a field in a database that needs the data entered without any spaces and I'm trying to figure out how to set either the validation rules or the masks so that the system will either automatically delete any spaces or warn the user not to enter them.

My preference would be for them to automatically be deleted.

Any ideas, suggestions?

I can figure out how to make either all numbers or all letters, but the data is both so that doesn't work.

Thanks, in advance, for your help.

Charis

View 4 Replies View Related

Query To Pull Most Recent Account Balance

Nov 6, 2007

I am trying to run a query to select the most recent balance from a table that lists balance by date and account number. Basically I need to select the most recent balance for a given account number. Here are the details:

Table: CBALANCE
=========================
ACCOUNTNO
BDATE
AMOUNT

What works: This gives me the most recent account, but I cannot get the amount
=========================
SELECT Max(CBALANCEMIB.BDATE), CBALANCEMIB.ACCOUNTNO
FROM CBALANCEMIB
GROUP BY CBALANCEMIB.ACCOUNTNO;

What I want to work: This returns results which should not be in the result set (older balances)
==========================
SELECT Max(CBALANCEMIB.BDATE), CBALANCEMIB.ACCOUNTNO, CBALANCE.AMOUNT
FROM CBALANCEMIB
GROUP BY CBALANCEMIB.ACCOUNTNO, CBALANCE.AMOUNT;

Am I trying to do something too complicated for the query language?

View 5 Replies View Related

Query To Pull Most Recent Account Balance

Nov 6, 2007

I am trying to run a query to select the most recent balance from a table that lists balance by date and account number. Basically I need to select the most recent balance for a given account number. Here are the details:

Table: CBALANCE
=========================
ACCOUNTNO
BDATE
AMOUNT

What works: This gives me the most recent account, but I cannot get the amount
=========================
SELECT Max(CBALANCEMIB.BDATE), CBALANCEMIB.ACCOUNTNO
FROM CBALANCEMIB
GROUP BY CBALANCEMIB.ACCOUNTNO;

What I want to work: This returns results which should not be in the result set (older balances)
==========================
SELECT Max(CBALANCEMIB.BDATE), CBALANCEMIB.ACCOUNTNO, CBALANCE.AMOUNT
FROM CBALANCEMIB
GROUP BY CBALANCEMIB.ACCOUNTNO, CBALANCE.AMOUNT;

Am I trying to do something too complicated for the query language?

View 6 Replies View Related

Queries :: Query To Pull ALL Records Whether Blank / Zero Or Value

Jun 24, 2013

I have two tables: Table #1) [Request Table] Customers request our company to stock a certain Part Number with a minimum value. Ajax - P/N "NP4i" - Min "30".

Table #2) [Sales History] All sales purchased and the "Qty-Total" purchased. For simplicity Fields are limited.I created a CrossTab Query that displays from [Request Table] P/N's requested/ min values (Row Headings) then showing P/N's purchased [Sales History] Value="Qty-Total" Sum and

Column=Format([Invoice Date],"mmm/yyyy") group by, showing last twelve months.
Ex: Customer name, Part Number, Minimum, May/2013, Apr/2013, Mar/2013 and so on.
AJAX, NP4i, 30 4 21 5 and so on.

The Crosstab query list only requested Part Numbers that have at least One sale wihin the last twelve months.If there are NO sales, the crosstab query will NOT show this Part Number.My boss wants to see the requested Part Numbers that were never purchased along with the ones purchased.He wants to address the NO sales, yet they requested we stock that particular Part Number for them.

Is there any criteria I can use to force the Part Number field on the [Request Table] side to populate even though there were NO sales within the last twelve months?

View 1 Replies View Related

Modules & VBA :: Can't Pull Form Text Box Value Into Query

May 21, 2015

I have a perplexing problem. I'm creating a simple db to enter borrower audit checklist data with the following tables:

Questions -- A list of 17 pre-defined audit questions, with fields QNum and Question
Audits -- One record for each audit (pk AuditKey is an Autonumber), and some borrower fields
AuditQuestions -- Linked to Audits, with pk of AuditKey and Qnum, and a Question and Answer (yes/no) field

The Audits form has the Audits table as its datasource, and an AuditQuestions subform. When I go to a new Audits record, there are initially no subform records attached. When I enter a borrower name, the field AfterUpdate event runs the following code:

Code:
DoCmd.OpenQuery "LoadAuditQuestions"
Me.AuditQuestions.Requery

The SQL for LoadAuditQuestions is

Code:
INSERT INTO AuditQuestions ( AuditKey, QNum, Question )
SELECT [Forms]![Audits]![AuditKey] AS Keyval, Questions.QNum, Questions.Question
FROM Questions
ORDER BY Questions.QNum;

I start out with both Audits and AuditQuestions tables empty. When I run the code by entering a borrower name, I get, "... can't append all the records in the append query ... didn't add 17 records due to key violations". It acts like it's getting a null value from Forms!Audits!Auditkey, but if I select the Debug option and check the value from the Immediate pane, it shows a valid number. Also, if I run the query manually with the form open, it loads the questions correctly.

The first Audits record is loaded with questions in the subform so you can see the desired results. To see the problem, go to a new record, enter a name, and hit tab. Another piece to the puzzle is, if you do this on an existing record, it works fine: Click No in response to the error message that appears, then click End on the Debug message. Go to a different audit record, then come back to the one you just created. Change the name, and it works correctly. It's as if it doesn't know what the AuditKey is the 1st time, but if you check it in debugger, it is loaded. In fact, I put in code in the AfterUpdate event to plug the LoanNumber field with the Forms!Audits!Auditkey value, and it worked, but the subsequent query still failed.

View 3 Replies View Related

Queries :: Query To Pull Previous Record

Jan 20, 2014

I have a form that is used to book a new event for a client who is already in the database.Within that form I have a subform that is based on a query which displays information from that client's previous event. I did this using a solution found in the following thread: URL...It is based on pulling the second to last record that is related to the current client. It works perfectly when booking a new event that has taken place on a previous date. However, if the previous event occured on that same date (but at a previous time), it doesn't register.

I would prefer a query that would pull the record previous to the current one, instead of pulling the second to last record out of all that client's events.it would also mean that if more events are booked, then a past event is opened in a form, the sub forms in that form will display the event just prior to the current record.

View 14 Replies View Related

Queries :: Adding Pull Down Menu To Query

Jul 28, 2014

I have a query built that gives me info per employee. I built a question into the criteria that ask for the employees name. When a person types the name results are given. If the person mispells the name, results are not given.

I have everyones name on a seperate table. How do i create a pull down menu on the query to choose the names?

View 7 Replies View Related

Queries :: How To Pull All Records In One Query If A Value Exists

Mar 18, 2014

I have one table let's call is table1. It contains about 5 columns with standard employee data with about 10,000 rows of data containing about 1,150 employees. All employees have multiple rows of data. There is one column titled JOB. I need to pull all rows of data for each employee ONLY if there is at the minimum one value for the employee in the JOB column. I do not want to pull employees that have no values in the JOB column. They can be excluded from the query.

Example of all record for one employee. I need to pull all rows of data ONLY if the employee has a value in the JOB column.

Name EE_ID JOB CAT EFF_DATE

John Doe 1006 CLERK F 01-JAN-2010
John Doe 1006 P 21-JAN-2010
John Doe 1006 CLERK P 01-FEB-2011
John Doe 1006 F 01-MAR-2011
John Doe 1006 P 01-APR-2011
John Doe 1006 CLERK F 01-JUL-2012

View 3 Replies View Related

General :: Pull All Records In One Query If A Value Exists?

Mar 18, 2014

I have one table let's call is table1. It contains about 5 columns with standard employee data with about 10,000 rows of data containing about 1,150 employees. All employees have multiple rows of data. There is one column titled JOB. I need to pull all rows of data for each employee ONLY if there is at the minimum one value for the employee in the JOB column. I do not want to pull employees that have no values in the JOB column. They can be excluded from the query.

Example of all record for one employee. I need to pull all rows of data ONLY if the employee has a value in the JOB column.

Name EE_ID JOB CAT EFF_DATE

John Doe 1006 CLERK F 01-JAN-2010
John Doe 1006 P 21-JAN-2010
John Doe 1006 CLERK P 01-FEB-2011
John Doe 1006 F 01-MAR-2011
John Doe 1006 P 01-APR-2011
John Doe 1006 CLERK F 01-JUL-2012

View 3 Replies View Related







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