Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

access courses in london - count queries

Forum home » Delegate support and help forum » Microsoft Access Training and help » access courses in london - Count queries

access courses in london - Count queries

ResolvedVersion Standard

Jonathan has attended:
Access Intermediate course

Count queries

I am familiar with COUNT queries, but I wondered if it was possible to COUNT within categories or ranges of values.

For example, I have 100 orders each of different amounts between

RE: Count queries

Jonothan,

You might need to do 3 separate queries until you find a better way. Create a basic query that has criteria on the AMOUNT field, and specify your range. Once this step is done, you can then count the number of records.

You could Also use a SQL statement like this:


You need to do a query where you use the Group By statement something like follows:

SELECT tblYourTable.Question1Answer, Count(tblYourTable.Question1Answer) AS MyCount
FROM tblYourTable
GROUP BY tblYourTable.Question1Answer
ORDER BY tblYourTable.Question1Answer;

tblYourTable = The name of your table.
Question1Answer = The name of the field with your answers in it.

This is one of the most powerful SQL abilities of course, but a lot of people forget that you can put a count() of in the SELECT statement to get the number of occurrences.







Access tip:

Random sampling

Data is th key to a good database, therefore checking is essential.

A good way of checking data is by random sampling. You can do this in a query, by typing the follow:
1) In the Field box create a RandonID field eg. Randon Id: Rnd(fieldname])

2) sort the field
3)Right click and chage the properties for To value to be the number of randon records you want to see.

4) Change the set to Show row for Randon ID to be False, add all the other fields you want to see and the run the query.

View all Access hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.11 secs.