help with count distinct workaround (1 Viewer)

mcalex

Registered User.
Local time
Tomorrow, 02:49
Joined
Jun 18, 2009
Messages
141
Hi all

I'm trying to put together a phone call logging system that has (amongst other things) a Call table (ID, SubjectOfCall, AdviceGiven, CallerID) and a Caller table (ID, Name, PhoneNum).

I'm trying to form a query that will tell me, for a given subject, the number of calls, and the number of callers. This way we will prioritise a subject with say, 10 calls from 10 different people higher than a subject with 10 calls from the same person

Because access doesn't have count distinct, I can't do this:
Select Call.Subject, count(Call.ID), count distinct(Caller.ID) from blah

Googling suggests derived tables/subqueries are the way to go, but I've found my subquery works in isolation, but when I use it in the larger query I get the same results as my first attempt (ie number of callers were counted, but not the number of different callers).

I can do this in vba, but would like to avoid such if possible. Is there a way to get the info I am looking for just using access sql, or do i need to dive into code?

many thanks
mcalex
_________
acc2003, winxp
 
Last edited:

stopher

AWF VIP
Local time
Today, 19:49
Joined
Feb 1, 2006
Messages
2,395
I've used three sub-queries here (attached) to create a final solution query.

hth
Chris
 

Attachments

  • caller.zip
    13.2 KB · Views: 105

Users who are viewing this thread

Top Bottom