Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

distinct value on the total field

Status
Not open for further replies.

99mel

Programmer
Oct 18, 1999
379
GB
I want to select distinct count instead of count in the total field in a select query.

Can this no be done?
 
Try:

SELECT COUNT(*) AS DistinctCount
FROM (
SELECT DISTINCT FieldName
FROM YourTable
) AS DistinctList

The subquery determines the distinct list of values in the field. The main query then counts the number of values in that list.
 
i've got the following sql query

select count(distinct fielda)
from tablea

this brings back an error!
 
Until they provide us with count(distinct [fieldname]), then in Access 97 at any rate, your best bet might honestly be to split it up into two queries - the first selecting the distinct values and the second using the first as a source.

An inelegant solution, but it would get you moving along...
 
they dnt allow it in Access 2000 either? thats what i'm using.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top