473,379 Members | 1,379 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

DISTINCT option of an aggregate function in Access 2003

In Microsoft's help literature, it states:

"You can filter out non-unique rows by using the DISTINCT option of an
aggregate function"

I am trying to do this in Access 2003 with the COUNT aggregate
function, but there is no reference, at least that I can find anywhere,
of how to do this. I have multiple lines fields for which I would like
to do a "count distinct", but for simplicity, I am showing an example
of only one field. Here is my SQL line:

SELECT [fishing data].userid, COUNT ([fishing data].browseragent) AS
CountOfbrowseragent
FROM [fishing data]
GROUP BY [fishing data].userid;

I have tried putting "DISTINCT" after COUNT, after the parenthesis
immediately following "COUNT" and various other forms:

COUNT DISTINCT ([fishing...
COUNT (DISTINCT [fishing data...
COUNT (DISTINCT ([fishing data...)
COUNT ([DISTINCT] [fishing data...

I cannot figure out the proper syntax. I have read through other posts
about users frustrated with inability to "count distinct" in Access,
but I thought that maybe this is an aggregate function option as stated
in the Microsoft help. I have been racking my brain with this. Any
assistance would be greatly appreciated!

Nov 13 '05 #1
1 14461
nf*******@gmail.com wrote:
In Microsoft's help literature, it states:

"You can filter out non-unique rows by using the DISTINCT option of an
aggregate function"

I am trying to do this in Access 2003 with the COUNT aggregate
function, but there is no reference, at least that I can find anywhere,
of how to do this. I have multiple lines fields for which I would like
to do a "count distinct", but for simplicity, I am showing an example
of only one field. Here is my SQL line:

SELECT [fishing data].userid, COUNT ([fishing data].browseragent) AS
CountOfbrowseragent
FROM [fishing data]
GROUP BY [fishing data].userid;

I have tried putting "DISTINCT" after COUNT, after the parenthesis
immediately following "COUNT" and various other forms:

COUNT DISTINCT ([fishing...
COUNT (DISTINCT [fishing data...
COUNT (DISTINCT ([fishing data...)
COUNT ([DISTINCT] [fishing data...

I cannot figure out the proper syntax. I have read through other posts
about users frustrated with inability to "count distinct" in Access,
but I thought that maybe this is an aggregate function option as stated
in the Microsoft help. I have been racking my brain with this. Any
assistance would be greatly appreciated!


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Access (JET) doesn't support the Count(Distinct <column>) function. The
Help article was about using DISTINCT like this:

SELECT DISTINCT <column list> ...
FROM ... etc. ...

There are various postings on this newsgroup about this problem. Search
Google groups for another answer. Or, perhaps this simple solution:

SELECT userid, Count(*) As BrowserAgentCount
FROM (SELECT userid, browseragent
FROM [fishing data]
GROUP BY userid, browseragent)
GROUP BY userid
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQnkxwIechKqOuFEgEQJBoACeKmriKMRO8bU9uFcpmbcrts rlm6EAn2cO
JtExwhvYCPf4gGpxJmyl7yiR
=FKwa
-----END PGP SIGNATURE-----
Nov 13 '05 #2

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

Similar topics

2
by: Keith | last post by:
I don't know what the correct syntax is to do what I want with the DISTINCT function (if it's actually possible). I have a query which displays a variety of fields from a variety of tables...
18
by: mathilda | last post by:
My boss has been adamant that SELECT DISTINCT is a faster query than SELECT all other factors being equal. I disagree. We are linking an Access front end to a SQL Server back end and normally are...
10
by: neb | last post by:
Dear member of the forum, Ms access has built-in aggregate function like: -Sum, Max, First, Avg, ... Is it possible to build user-defined aggregate? (if you have any clue, do not hesitate to...
1
by: Najib Abi Fadel | last post by:
Hi i have an ordered table of dates let's say: 1/1/2004 8/1/2004 15/1/2004 29/1/2004 5/2/2004 12/2/2004
6
by: dick | last post by:
Am working with MS Access 2003 & tables downloaded from Oracle. Am not a GURU, more of a hacker, but have done a bit of everything in many languages/programs/etc. I have data fields in 2 tables...
1
by: mianiro | last post by:
I want to use a distinct and a top in a select statement, however I want the distinct to only apply to one of the columns. For example SELECT DISTINCT TOP 15 col1,col2,col3,col4 from table1 I...
4
by: wrldruler | last post by:
Hello, First, I know it's against "Access Law" to save calculations in a table, but....I want/need to. I currently have sub-totals being calculated inside a form, using DMax, DCount, and...
5
by: movieking81 | last post by:
Hello All, I'm building an inventory database for my company and I need to setup some specific select statements to write the material to a web page. There are duplicate descriptions in the...
8
by: Floortje | last post by:
Hi i have been struggeling with this question for quite some time now. I have some helper classes that handle images (upload an image, create thumbnails and show a imagelist), links (add link,...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.