Single result from multiple records each month

G

Guest

I have a table with client visits entered by visit date. I need a query that
returns only one result for each client even if the client visits multiple
times. I am creating a report that shows the count of different clients
visited each month over a years period.

Sample of table data:
Client # Visit date
1 1/1/06
2 1/3/06
1 1/10/06
3 1/5/06
4 2/1/06
1 2/10/06

What I need from above is:
# of different clients visited each month
Jan Feb
3 2

Thanks in advance for any help.
 
T

Tom Ellison

Dear MJ:

SELECT [Client #], Month([Visit date]), COUNT(*) AS Ct
FROM YourTable
GROUP BY [Client #], Month([Visit date])
ORDER BY [Client #]

This may be a starting point. Make a cross-tab from this. You need the
month number to put them in order. The names of the months, ordered
alphabetically, may not be desirable.

Tom Ellison
 

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

Similar Threads

Unique Record 1
Between 2 dates 1
Count years in date range 3
Find the most recent date for a record 2
Running Totals / Running Sums 2
breaking a month into weeks 3
help in a simple query 2
Grouping in Order 13

Top