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 MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

count distinct records

Status
Not open for further replies.

p27br

Programmer
Aug 13, 2001
516
GB
Hi,

I am trying to achieve the following in Access :

SELECT COUNT(SELECT DISTINCT ID FROM myTable) AS DistinctCount

but i can't get the syntax right, any suggestions ?

thanks
 
Hi

I found an answer by doing a search in the forums

thread701-868551


 
This Access sql returns two columns. The first column displays each unique value in field1. The second column displays totals for each unique value in field1.

SELECT
table1.field1,
Count(table1.field1) AS [total]
FROM table1
GROUP BY table1.field1;

With Access it is quite helpful to use the query design window, even if you already know sql.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top