473,698 Members | 2,410 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Count distinct occurences

I have a query that provides detail for sales transactions meeting certain
criteria (date, purchase type, etc.) I am creating a report based on that
query, and I want to add a summary section. I want to add some counts, such
as the number of unique customers that purchased. I know can do this by
running a new query to group by customerID, then doing another query against
that to count the records, but there has to be a better way. Can I get what
I need without a subquery? (I'm using AccessXP on a 2000 format database.)

Thanks,

--
Steve Heath
Nov 12 '05 #1
1 3560
Steve
You can use report's groups. It depends, of course, how many summaries
you want to do, but in case of unique customers:
- group your report by customer
- in the group header (might be invisible) insert a text box =1
running sum over all (might be invisible, if the header is visible)
- in the report footer insert a text box=[name of text box in the
customer header]
When one needs to calculate simple summaries, running sum is good.
Atherwise, yes, subreport based on its own query.
Hope, it will help.
Galina

"Steve Heath" <st************ ***@sbcglobal.n et> wrote in message news:<Bj******* ************@ne wssvr33.news.pr odigy.com>...
I have a query that provides detail for sales transactions meeting certain
criteria (date, purchase type, etc.) I am creating a report based on that
query, and I want to add a summary section. I want to add some counts, such
as the number of unique customers that purchased. I know can do this by
running a new query to group by customerID, then doing another query against
that to count the records, but there has to be a better way. Can I get what
I need without a subquery? (I'm using AccessXP on a 2000 format database.)

Thanks,

Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
51359
by: Dean | last post by:
I want to build query to return how many rows are in this query: select distinct c1, c2 from t1 But SQL won't accept this syntax: select count (distinct c1, c2) from t1 Does someone know how to count multiple distinct columns? Thanks.
17
16374
by: keith | last post by:
I am trying to get a exact count of different distinct entries in an Access column. At first, I was trying to work with three columns, but I've narrowed it down to one to simplify it. I've searched Google Groups for Distinct Count and Count, the Microsoft Help file (which apparently has bad links in Office 2003), and looked at other files, but I can't find the answer. The closest I've been able to get is to create a query to find the...
2
55928
by: Michael Howes | last post by:
I have a single DataTable in a DataSet. It has 4 columns and i'd like to get a handful of counts of unique items in 3 of the 4 columns. Can a DataTables Select or Compute methods to COUNT DISTINCT? These two attempts failed DataRow dr = ds.Tables.Select( "COUNT(DISTINCT(site_name))" ); object x = ds.Tables.Compute( "COUNT(DISTINCT(site_name))", "ProductionCount > 0" );
5
8132
by: JimmyKoolPantz | last post by:
for some reason I can't seem to figure this out. Situation: I'm using vb.net to create a query that will populate a dataset with zipcode and count that have unique first 3 digits. I want to create an audit that shows the client that he has so many reocords in a 3 digit zip. sampe data name | zip john 32118
22
12476
by: MP | last post by:
vb6,ado,mdb,win2k i pass the sql string to the .Execute method on the open connection to Table_Name(const) db table fwiw (the connection opened via class wrapper:) msConnString = "Data Source=" & msDbFilename moConn.Properties("Persist Security Info") = False moConn.ConnectionString = msConnString moConn.CursorLocation = adUseClient moConn.Mode = adModeReadWrite' or using default...same result
1
2596
by: Bill | last post by:
I'm trying to write a query that will select a distinct count of more than one field. I have records that display user productivity. Each of the records have a time associated with it and I want to be able to tell the distinct count of the products numbers and of the pallets ID that they worked with. Do need to work out some sort of sub-query to do this?
0
2864
by: uninvitedm | last post by:
Heya I've got a table of invoices, which have dates and customer_id's. What I need to get is the number of occurances for this customer for a 12-month range window. For example, if there's an invoice for october for a certain customer - i want to count how many other invoices appear are for this customer in the 12 months from that invoice date. Similarly, if there's an invoice in november, that should show the number of occurences 12 months...
4
4837
by: tom booster | last post by:
Hi All, I'm trying to convert a T-SQl query to DB2. I have two tables policy and policyHolder. I would like a count of the amount of distinct poicyHolders per policy, for a particular set of new policies. select P.policyID, (select count(PH.PolicyHolderId) from PolicyHolder PH where PH.policyID=P.policyID) CountPolicyHolders from Policy P
5
6925
by: Larry | last post by:
Dear all, I'm new to Python. I have a file (an image file actually) that I need to read pixel by pixel. It's an 8-bit integer type. I need to get the statistics like mean, standard deviation, etc., which I know a little bit already from reading numpy module. What I want to know is how to get the number of occurences of numeric element in an array. Say, b = array(()
0
8676
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
8898
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7734
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4370
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3051
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2332
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2006
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.