Count Unique Records

Sep 15, 2006

Hello, I am new to Access and trying to run a query that will count only unique invoice numbers in my table. I am sure this is an easy command, and thank you for your help!

View Replies


ADVERTISEMENT

Count Unique Records

Sep 10, 2003

Hi there:

I have a Question

In Access 2002 (XP) I have to write a query that displays unique Id's:

For Example:

CustomerID Company Name
1 ABC INC
1 ABC INC
2 XYZ INC
2 XYZ INC
3 PQR INC

The query should be 3 records.

But for some reason when I write the query in sql view it doesnot work.

Thanks,
Ashi
http://www.ringvirginia.com

View 12 Replies View Related

Reports :: Count Unique Records Only

Sep 30, 2013

In a report, I have a textbox to show the number of employees in the report.

I use this formula : =Count([last name])

Sometimes the same person has multiple entries, so the count is wrong.

How can I show only the number of different employees and ignore the duplicate names?

View 3 Replies View Related

Count Function To Return Unique Records

Sep 20, 2005

Not sure if I worded my subject correctly. Here's my problem.. I've used query to combine 2 tables of data..

Here are my fields..

I've assignment_num field, project_num field, project_name field, emplyee_name field.

here are my data..

assignment_num field: 1001, 1002, 1003, 1004, 1005
project_num field: 20,20,15,16,15
employee_name field: tom peter, tom peter, tom peter, julie, sally

What I want is to display the employee name with 2 projects or more...

What i have done?
I've done a group by and then count project_num field.. I also added a condition whereby the countofproject_num > 1.. everything went well except that the countofproject_num display 3 instead 2..

pls help.

View 13 Replies View Related

Modules & VBA :: Count Number Of Unique Records Based On Range Of Date

Jan 19, 2015

Code:
' count records in query
Dim rs As DAO.Recordset
Dim db As Database
Dim strSQL As String
Dim beginDatum As String
Dim eindDatum As String
Set db = CurrentDb

[code]....

View 4 Replies View Related

Count Unique (yep, Again)

Sep 20, 2007

Hello,

I noticed my subject has been discussed numerous times in this forum. I must have read nearly all topics, but I simply can't get it to work.

I have a table listing: country | category | article | turnover

I wish to make a query which gives me:

country | sum of turnover | count of (unique) categories used by this country | count of (unique) articles sold by this country.

This way I can evaluate with how many different categories a certain country achieves a certain turnover...

It look so simple but I can't figure it out. I hope I'm clear in my question.

HEEELP!

Cheers,
Stefan

View 2 Replies View Related

Queries :: How To Count Unique Dates

Aug 4, 2015

I want to do a unique count of dates when an activity was done in my table. The table may have multiple entries of the activity performed possibly on the same date by an individual

e.g. table entries

Code:

approvalNoSys dateAssessed Activity
100 01/08/2015 Audit
100 01/08/2015 Audit
100 01/05/2015 Audit
100 01/05/2015 Audit
100 01/02/2015 Audit
100 01/01/2015 Audit

Unique audit Count must equal 4

Code:

totV = ECount("[dateAssessed]", "R_P_Data_P", "[approvalNoSys] = '" & [Forms]![cmrOverview]![txtappNoSys] & "' AND [Activity] Like '*audit*'")
totV = Unique count
dateAssessed = date field in R_P_Data_P table
R_P_Data_P = table
"[approvalNoSys] = '" & [Forms]![cmrOverview]![txtappNoSys] & "' = criteria for the customer in question to separate them from many other customers in the table.
Activity = text field in R_P_Data_P table
audit = the activity

I'm also trying to avoid having to build total queries etc to them reference them, I'd like getting the desired outcome in an expression or small code.

I read about Ecount but my complier doesn't recognise the function

View 6 Replies View Related

Queries :: Count Unique Dates

Jan 10, 2014

I have 2 linked tables, tblPN & tblReceivedDate. tblPN has field PN and tblReceivedDate has field [Received Date]. The tables are used to record the receipt of different part numbers and the date they received. I want to use a query to count how many times a part number is received. The catch is that I only want to count a part once even if it is received more than once on the same date. With the data in the attached DB the count for PN 123 would be 5.how to configure the query to do what I need to do?

View 9 Replies View Related

Reports :: Returning A Unique Count In A Report?

Oct 27, 2014

I have a report. behind that report is a query.

The query returns the parts used for each job. This could be 1 to many, so I get 1 to many rows returned in the query for each job. There can be a number of jobs to a work schedule (I'll call this WS). Each job is for a particular model. So I bascially have

WS1 JOB1 MODELx PART1
WS1 JOB1 MODELx PART2
WS1 JOB1 MODELx PART3
WS1 JOB1 MODELx PART4
WS1 JOB2 MODELw PART7
WS1 JOB2 MODELw PARt8
WS1 JOB3 MODELx PART5
WS1 JOB3 MODELx PART6

I want to count the number of jobs each model appears in ie MODELx appears in 2 jobs, MODELw appears in 1 job.

I've read DCOUNT can eliminate duplicates but I can't see how to use it to do so.

I have (general gist)

DCOUNT("model number"."query","model number" = [model num])

View 3 Replies View Related

Queries :: Count Unique Values Without GROUP BY

Sep 15, 2013

I am currently using the below code to query values that have a unique "OverrideDescription" and where by the "Upload Date" is always the latest.

SELECT t1.*
FROM [DaisyServiceRates-Amended] AS t1 LEFT JOIN [DaisyServiceRates-Amended] AS t2 ON (t1.OverrideDescription = t2.OverrideDescription) AND (t1.[Upload Date] < t2.[Upload Date])
WHERE t2.OverrideDescription IS NULL;

However I also need to be able to do a unique count of the [OverrideDescription] field.

I have found methods whereby I can do use, but they all use a GROUP BY function, the issue being that when I use this method it prevents be from updating the values saying "recordset not updateable".

Any method that does not use the GROUP function. I did also try preforming the COUNT on a separate table and doing as JOIN, but this also prevented updates to the date.

View 1 Replies View Related

Queries :: Access 2007 / Query Count Of Unique IDs

Jan 16, 2014

I have a basic query off a currency table :

Quote:

SELECT tblCurrencies.CcyID, tblCurrencies.Ccy
FROM tblCurrencies
ORDER BY tblCurrencies.Ccy;

Now - I have a separate table of balances, which is linked to the currency table by the same CcyID, and which also has identifiers to link it to other tables (e.g. AccountID)

As part of the above query, I want to return the count of unique AccountID's in the balance table for each currency. So in other words, I want to know, for each currency, how many unique accounts exist?

Each AccountID could appear one or more times in the balance table (one-to-many relationship), so I only want to count the number of unique ID's.

So I started with the following :

Quote:

SELECT tblCurrencies.CcyID, tblCurrencies.Ccy, Count(tblBalances.AccountID) AS NoOfAccounts
FROM tblCurrencies INNER JOIN tblBalances ON tblCurrencies.CcyID = tblBalances.CcyID
GROUP BY tblCurrencies.CcyID, tblCurrencies.Ccy
ORDER BY tblCurrencies.Ccy;

But this just gives the number of AccountID's per currency (regardless of duplication within them)

I found this article which informs me that a Count(Distinct) query won't work in Access and to use subqueries instead.

View 14 Replies View Related

Modules & VBA :: Total Count Of Unique Values In A Query

Jan 13, 2015

I have the following code:

Code:
Dim rs As DAO.Recordset
Dim db As Database
Dim strSQL As String
Set db = CurrentDb
strSQL = "SELECT DISTINCT tbl_contract_lev.ContractID FROM (tbl_leverancier_gegevens INNER JOIN

[Code] ....

The result of the query is a list fo unique values but by including the "count" function in SQL seems not te be working in combination with "DISTINCT"...

View 5 Replies View Related

Count Records Problem. Display Field Even When Count Is Zero.

Apr 13, 2006

I have a table tblBookings.

In this table it has a bookingID, CustomerID and some other none relevant details.

The CustomerID comes from table tblCustomer. i.e a customerID must exist in the customer table to be allowed in the bookings table tblBookings

A customer can exist in tblCustomer without existing in the booking table.

I am trying to write a query that will list each and every customer ID in the tblCustomer and count the number of bookings that that customer has (even if it is zero).

I have a query that will count the bookings if they exist in the booking table and display the number of times that a customer appears in the bookings table.

SELECT tblBookings.CustomerID, Count(tblBookings.CustomerID) AS NoOfBookings
FROM tblBookings
GROUP BY tblBookings.CustomerID;


How do I create a query that will do this but list all customers even if they don't exist in the bookings table (but obviously occur in the customers table)

I am trying to create a similar query where all bookings per hotel are listed even if no bookings are made for that hotel. I am guessing the answer is the same as above.

The Ritz. Bookings 0
The Hilton. Bookings 3
The Carlton. Bookings 0
The Lowry. Bookings 2

For every hotel.

That kind of thing.

If you need more information please shout.

View 3 Replies View Related

Unique Records?

Sep 2, 2004

I have sort of a complex unique fields question. And I know there are probably quite a few ways to get at the answer, but I'm a novice so the simplest way would be best. I have a table (with over 25M rows, otherwise I'd be doing this in excel) with many columns. One of the columns is employee ID, and another is a date. Each employee ID however can have multiple rows with different dates. As an end product I need to have one row for each employee ID with the most recent date. An idea I had would be to sort by employee ID and then by the date. Then insert a column of if statements that asks if a record has the same employee ID as the record below it, but I don't have any experience with if statements in access (and VERY little SQL experience). But there is probably an easier way. Any help would be appreciated. Thanks!

View 1 Replies View Related

Unique Records

Sep 8, 2006

I have a database that contains sales order information. A sales order could have multiple records (if that sales order has several different items ordered) or just one record. There is a status column in each record that shows a "C" (for closed). For items that were not delivered in a particular sales order, the status column is left blank.

Here is an example:

Sales Order Item Ordered Status
908111 Coaxial Cable C
908111 Transreceiver C
908111 Connector
908112 Coaxial Cable C
908112 Transreceiver C
908112 Connector C

The above example shows that only 2 items from sales order # 908111 were delivered or "C" but one of them is not. For sales order # 908112, all items were delivered or "C". I want to take all records of sales order # 908111 and show it on a table of partially delivered and all records of sales order # 908112 in delivered table.

I've tried different filtering options and group by but it doesn't seem to be working. Anyone has any ideas?

View 1 Replies View Related

Subforms & Unique Records - Please Help!

Apr 12, 2006

Firstly, my thanks to everyone who is going to be able to help with my problem, and also my apologies if this thread isn't in the right forum.

Ok, I am trying to construct a database at the moment for a small business. The database holds a number of customer records, and all of the basic design and construction I am skilled enough to write myself.

However, I'm running into major problems whilst trying to tackle a certain task...


The Required Situation

I have a form called Contacts. This form shows all of the customer details, laid out neatly, and draws its information from a table of the same name. This aspect works fine.
Now what I've been asked to look into is the possibility of adding two buttons to this form. Each button, when clicked, will open a pop-up window where extra details, such as a log of received telephone calls, can be entered and searched if necessary. the two buttons should do the same thing where the code is concerned, but store their details separately (one button is for sales calls logged, the other for support calls).
Now it is essential that these records are tied - uniquely - to whichever record the database user was on when they clicked the button.


My Current Thinking

I'm stumped. Well, half stumped. I think that the solution lies in sub-forms, but I'm not nearly skilled enough to actually impliment them (and don't want to waste my time doing so if there's an easier way).
Currently I have two tables, contacts and calls, the former to store the customer information, the latter to store the calls that are entered on this new form.
The form contacts has a button on it which opens the form calls. Now I can go to any record I like, click the button and open the calls form. I can enter details for such, and the record gets saved to my calls table. The problem is that it is not unique. No matter which record I'm on when I open the calls form, the details are always the same.

Yes, I know the absoute easiest way is to simply have a few fields on the main contacts form to log these details, and that it will uniquely tie to that record, but unfortunately that is not a practical solution. These calls may run into the hundreds, and must be easily navigated by the database users.



If I've not been clear enough, I can attach a copy of my database for you guys to take a look at, but what I'm after in the first instance is (a) whether there is an easier way to solve my problem, and, (b) if not, whether I'm right about needing subforms.

View 14 Replies View Related

Can Unique Records Be Counted?

Jun 23, 2006

Hello

New to Access, new to this forum

I hope this is the right place for this question?

I have a table of data, with the following headings:

"group1","group2","groupage","Reference","name","team","pres","CB","CBPR","LA","LA PR","IS","ISPR","N","NPR","Origin"

I am trying to get a count of unique "References" (there are normally over 20,000) for each "group1" or "group2" by "groupage"

I can do this using Excel........but it is a very long winded process getting the data ready to use a pivot table.

Can anyone help me? Or do I need to provide more information?

Any help will be greatfully received. :)

View 10 Replies View Related

Best Way To Produce Unique Records

Jul 25, 2005

Hello, hoping for some help on the following scenario:

I need to produce a query which results in one record for each part number.

In a sample table of purchasing history (tblPODetails):
Fields:
PartNumber, Description, Cost, DatePurchased

We have purchased any given part number numerous times over the years. From time to time, descriptions have changed, as have our cost and of course the date received.

I am attempting to create a query which gives me a list of part numbers with no duplicates, showing the part number, description and cost by max date received.

The resulting description field would of course be the one in use for the latest received date.

I am not having much luck. When I add more fields to the totals query (other than part number and max date received), I get duplicates. I know this should be simple for me...

View 4 Replies View Related

Find Unique Records

Mar 23, 2006

Feeling stupid today...how can I query a table to find the last five unique records?

Table1:
PrimaryKey
Field1

Field1 may contain duplicates. I need the five latest entered unique records in Field1, and am struggling to write a query for this.

Many thanks to anyone who can help out.

[Still using Access 97]

View 1 Replies View Related

Cannot Retrieve Unique Records

Mar 14, 2006

:confused:

I have been working on a normalized db for the past few months and it works wonderfully. But now I need to find a way to create a form so that the rest of the company can update their data.

My Table has the 5 following fields. Also listed is an example of the types of data I have there

StoreID_Catagory_Customer Year_Month_MixPercentage
IN00001_Japanese_____2005_____Jul_______.01______
IN00001_Japanese_____2005_____Aug______.02______
IN00001_Japanese_____2005_____Sep______.01______
IN00001_Chinese______2005_____Jul_______.35______
IN00001_Chinese______2005_____Aug______.25______
IN00001_Chinese______2005_____Sep______.26______
IN00001_Japanese_____2006_____Jul_______.01______
IN00001_Japanese_____2006_____Aug______.02______
IN00001_Japanese_____2006_____Sep______.01______
IN00001_Chinese______2006_____Jul_______.35______
IN00001_Chinese______2006_____Aug______.25______
IN00001_Chinese______2006_____Sep______.26______

As you can see I have multiple StoreID's for one store, IN00001. My db goes up to IN00419 so it ends up displaying 29,664 records. There are 4 different categories (Japanese, Chinese, Local, and Other). Until now everything has been taken from a datasheet and put into an Update Query but now that other people have to quickly access the system I need a slick interface.

What I need is a way to have a form that can update the table and add new entries that looks like this in the form:

IN00001____2005________Jul__Aug__Sep__Nov__Dec__EC T.
Japanese MixPercentage__.01___.02__.01___.03__.01
Chinese Mix Percentage___.35___.25__.26___.33__.30
Local Mix Percentage_____.60___.70__.69___.62__.65
Other Mix Percentage_____.04___.03__.04___.02__.04

IN00001____2006________Jul__Aug__Sep__Nov__Dec__EC T.
Japanese MixPercentage__.01___.02__.01___.03__.01
Chinese Mix Percentage___.35___.25__.26___.33__.30
Local Mix Percentage_____.60___.70__.69___.62__.65
Other Mix Percentage_____.04___.03__.04___.02__.04

I hope this gives you a clearer picture. I need to be able to update 96 entries at a time (12months, 4 customer types, 2 years) but do it in an efficient manner. The table only has 5 fields so I need to figure out how to display multiple entries on the same form. I also need a way to add new entries. In other words for me to add another StoreID such as IN00420 then I would have to enter in a value for every field for 96 records in the table. When in reality I should only need to update the mix percentages since the months and years remain constant. HELP!!

Any help would be much appreciated. Due to the variable nature of the db I cannot establish very many one-to-one relationships. So therein lies another problem.

View 3 Replies View Related

General :: How To Get Unique Records

Oct 24, 2012

I am trying to build a query using two tables. One is a table called sanctuary lakes cleaning data. The other one is called Faulire data. In cleaining table there are four years of cleaning records for each pit. I want to find the performance of these cleaned pits using failure table. Each failure date should have only one correspoding cleaning date. I wrote the following query. This query works. But it gives duplicate data. Some of the records will show two cleaning dates for a failure.

My query is like this.

SELECT DISTINCTROW [Sanctuary Lakes cleaning data].PIT, [Sanctuary Lakes cleaning data].[Cleaned Year], [Sanctuary Lakes cleaning data].[Cleaning Date], [Sanctuary Lakes cleaning data].[SR NO], [Failure data table].[Failure Year], Min([Failure data table].Failure_date) AS MinOfFailure_date, [Failure data table].[Failure SR no]
FROM [Failure data table] LEFT JOIN [Sanctuary Lakes cleaning data] ON [Failure data table].Pit = [Sanctuary Lakes cleaning data].PIT
GROUP BY [Sanctuary Lakes cleaning data].PIT, [Sanctuary Lakes cleaning data].[Cleaned Year], [Sanctuary Lakes cleaning data].[Cleaning Date], [Sanctuary Lakes cleaning data].[SR NO], [Failure data table].[Failure Year], [Failure data table].[Failure SR no]
HAVING (((Min([Failure data table].Failure_date))>Min([Sanctuary Lakes cleaning data]![Cleaning Date])))
ORDER BY [Sanctuary Lakes cleaning data].PIT;

My results are as follows:
PIT Cleaned Year Cleaning Date SR NO Failure Year Failure_date Failure SR no
1-08 2007/08 16-Oct-07 213458 2011/12 13-Aug-11 414984
1-08 2007/08 16-Oct-07 213458 2011/12 25-Jun-12 478589
1-08 2009/10 19-May-10 313497 2011/12 13-Aug-11 414984
1-08 2009/10 19-May-10 313497 2011/12 25-Jun-12 478589
1-08 2010/11 22-Feb-11 379081 2011/12 13-Aug-11 414984
1-08 2010/11 22-Feb-11 379081 2011/12 25-Jun-12 478589
1-08 2011/12 17-Apr-12 458430 2011/12 25-Jun-12 478589

I want the following results.

PIT Cleaned Year Cleaning Date SR NO Failure Year Failure_date Failure SR no
1-08 2010/11 22-Feb-11 379081 2011/12 13-Aug-11 414984
1-08 2011/12 17-Apr-12 458430 2011/12 25-Jun-12 478589

How can I modify my query?

View 2 Replies View Related

Unique Records Sorted By Date

Jan 10, 2006

Hi All,

Just a quick enquiry if I sort a query by a date field in ascending order then select unique records will I get the latest records.

Thank You

View 1 Replies View Related

Unique Records/Values Problem!!

Jan 13, 2006

Here's my situation...

I'm making a query that uses information on company members from a database. The most important data field is the MemberID. Many members are listed in the table more than once because different records are put in when they have more than one contact person or health plan, etc.... However, right now I am trying to have the query make a table that produces only one record for each company so I can get a total number of companies. Therefore, I dont want the query to produce records with duplicates of the MemberID. My problem is that by setting Unique Values to 'Yes' doesn't work because if a different field in the record is different, it makes the record unique. I can't figure out a way to make it so only one field is considered for unique values. The funny thing is that it is simple to do this in Excel, you just gotta go to advanced filters. Does anybody know how to do this in Access?? Thanks.

View 14 Replies View Related

Find Unmatched/Unique Records

Mar 14, 2006

Hi all,

I thought this would be relatively simple task to complete but its proving tricky.

I have two tables with the same data: E1 and E2

E1 has two columns and is as follows

A 1
B 2
C 3
D 4

E2 is similar except for one record '5'

A 1
B 2
C 5
D 4

Now the task is to show those records that do not match...in this instance

E1.Field1 E1.Field2 E2.Field2
C 3 5

Now I've used the find unmatched wizard and this is the SQL:
SELECT E1.Field1, E1.Field2, E2.Field2
FROM E1 LEFT JOIN E2
ON E1.Field2 = E2.Field2
WHERE (((E2.Field2) Is Null));


this is giving me partially the right answer as in
E1.Field1 E1.Field2 E2.Field2
C 3

Anyone else think of some other way?

View 2 Replies View Related

Finding Unique Records Between 2 Tables

May 12, 2006

Dear all,

Many thanks for taking the time to read this.

I have a slight problem which seems like it should be easy to solve but I have no idea how to do it.

I have 2 tables (table1 and table2 for instance) Table2 contains more data than table1 but should contain everything in table1 as well as more.

How is it possible to return just records that are in table2 that are not in table1

Eg

Table1 contains:

IDab
112
222
322
422
511
611
711

Table2 contains:

IDab
112
222
322
422
511
611
711
833

The query should return just the line:
833
as this is unique.

thanks again

View 6 Replies View Related

Counting Unique Records In A Query

Jun 1, 2006

I'm having trouble getting a query to return a simple count of unique lot numbers for a given ProductID. The data is stored in a large table where each test result of a stability program is stored. Each result has an associated lot number, product id and several other data fields. I've managed to get a combination querries to return the count, but if the lot has both real time and accelerated data then the counts are added and reported as double for each type. The current SQL is as follows.

SELECT tblProducts.ProdName, Count(qryAccelerated.Lot) AS AccelCount, Count(qryRealTime.Lot) AS RTCount
FROM qryRealTime RIGHT JOIN (qryAccelerated RIGHT JOIN tblProducts ON qryAccelerated.ProductID=tblProducts.ProdID) ON qryRealTime.ProductID=tblProducts.ProdID
GROUP BY tblProducts.ProdName
ORDER BY Count(qryAccelerated.Lot) DESC , Count(qryRealTime.Lot) DESC;

qryAccelerated and qryRealTime are simple SELECT DISTINCT querries returning the product id and a list of unique lot numbers for that ID.

(e.g. SELECT DISTINCT tblResults.ProductID, tblResults.Lot FROM tblResults WHERE (((tblResults.TypeID)=3));)

Currently the top query returns 4 in the both the AccelCount and RTCount columns when there are only 2 unique lots for the product. Other products without both real time and accelerated lots count correctly.

Any help is greatly appreciated. Thanks.

View 4 Replies View Related







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