Simple Query Count

  • Thread starter Thread starter Scarlet via AccessMonster.com
  • Start date Start date
S

Scarlet via AccessMonster.com

Hello All!

Please help me put together this simple enough query. The fields are "region",
"period", "yusage", and "arrival". My query as of right now returns all the
information that I need, though I am not sure what I need to do to properly
format it.

For example here are two sample records....

South East, 2, 2005, 1/12/2006
South East, 2, 2005, 1/15/2006

Now I would like it to display one single record encompassing above as this...
..

South East, 2, 2005, 2

(in effect I am saying in the south east region during period 2 of 2005, 2
people visited us)

FYI - the "period" field is is a date range set from Jan 1st - Jan 28th,
there are 13 total periods.....


Thanks!!!
 
Create a new query and drag the 4 fields into the grid.

Change the query to a Totals query (either click on the Sigma icon on the
button bar, or select Totals from the View menu). That will add a new row to
the grid labelled "Total:", with the cell for each user column preset to
Group By. Change the Group By to Count under the Arrival field, and you're
done.

The SQL associated with this query will look something like:

SELECT region, period, yusage, Count(arrival)
FROM MyTable
GROUP BY region, period, yusage
 
Thank you Doug,

That gets me about half way there.....

for example,

South East, 2, 2005, 1/12/2006
South East, 2, 2005, 1/15/2006
South East 2, 2005, 1/12/2006

Once the counter runs it produces...

South East, 2, 2005, 2
South East, 2, 2005, 1

How do I produce....

South East, 2, 2005, 3

Thanks so much.


Create a new query and drag the 4 fields into the grid.

Change the query to a Totals query (either click on the Sigma icon on the
button bar, or select Totals from the View menu). That will add a new row to
the grid labelled "Total:", with the cell for each user column preset to
Group By. Change the Group By to Count under the Arrival field, and you're
done.

The SQL associated with this query will look something like:

SELECT region, period, yusage, Count(arrival)
FROM MyTable
GROUP BY region, period, yusage
Hello All!
[quoted text clipped - 24 lines]
Thanks!!!
 
If the query you created isn't doing it, then there must be something that
Access sees as different between the records, such as an extra space.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Scarlet via AccessMonster.com said:
Thank you Doug,

That gets me about half way there.....

for example,

South East, 2, 2005, 1/12/2006
South East, 2, 2005, 1/15/2006
South East 2, 2005, 1/12/2006

Once the counter runs it produces...

South East, 2, 2005, 2
South East, 2, 2005, 1

How do I produce....

South East, 2, 2005, 3

Thanks so much.


Create a new query and drag the 4 fields into the grid.

Change the query to a Totals query (either click on the Sigma icon on the
button bar, or select Totals from the View menu). That will add a new row
to
the grid labelled "Total:", with the cell for each user column preset to
Group By. Change the Group By to Count under the Arrival field, and you're
done.

The SQL associated with this query will look something like:

SELECT region, period, yusage, Count(arrival)
FROM MyTable
GROUP BY region, period, yusage
Hello All!
[quoted text clipped - 24 lines]
Thanks!!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top