Queries

  • Thread starter Thread starter Desmond
  • Start date Start date
D

Desmond

I have a database that is designed as follows: there are
two big tables: one with demographic information about
people, another that specifies encounter information each
time these people come to the office. Each person has a
primary key, and the two tables are linked by this key.

I am trying to write a query that will let me know how
many unique people we see, as opposed to how many total
office visits.

I have written a query where the number I want to report
ends up being the number of records in the resulting
query table, but I can't seem to get the query to
actually give me that number.

Please help
 
Hi Desmond,
Quick and dirty solution:
Use a Totals query on the Visit table alone. Group By
primary key (if unique to each person- I presume so), and
see how many records are produced. You could add the
primary key twice to the grid, Do a Group By on the first
instance and a Count on the second. This would give you
how many times each unique person occurs in the Visits
table.

If you need names to go with the id and names don't
occur in the Visits table, join the Demographics table
into the query and pull the names out of it to go with the
ID from the Visits table.

The output of this query could feed a report if you
want something pretty to pass along.

Just a thought...
 
Back
Top