Question

Locked

Advanced count query

By jimmy-jam ·
Hello all. I'm trying to figure out a way to run some type of query against my Access Database in which I can count the number of time a distinct string shows up.

I tried

select count(ColumnName) from tableName where ColumnName like %string%

Apparently you can't do that. Can anyone offer some suggestions as to how I may accomplish this? I only need it to return a number.

This conversation is currently closed to new comments.

1 total post (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Collapse -

Would it be something like this?.

Access: Count Function

In Access, the Count function returns the number of records in a select query.

The syntax for the Count function is:

Count( expression )

expression can be a field or any string expression.

SQL/Queries

You can use the Count function in a query by clicking on the Totals button in the toolbar (This is the button with the summation symbol). The Count function is used in conjunction with the Group By clause.

This query would return the number of records for each ProductName. You can actually substitute any field with the Count function and it will return the same count result. In this case, we've used the SupplierID field to determine the number of records for each ProductName.
http://www.techonthenet.com/access/functions/numeric/count.php

Please post back if you have any more problems or questions.

Back to Web Development Forum
1 total post (Page 1 of 1)  

Related Discussions

Related Forums