Clif
asked on
Counting Unique Records
I'm using Crystal XI
I have a report that lists jobs per cost center. Some jobs can show up on different cost centers. If I count records (how I'm currently doing it), I get more jobs than are actually on the report.
My current query is something like:
What I need is something like
These, of course, would be filtered through Crystal's Record Selection Formulae.
Is there a way to count just the unique records based on a single field?
I have a report that lists jobs per cost center. Some jobs can show up on different cost centers. If I count records (how I'm currently doing it), I get more jobs than are actually on the report.
My current query is something like:
SELECT *
FROM MyView
which returns 150 records. This is not the number of jobs, since a job might appear in two or more rows with differing cost centers.What I need is something like
SELECT COUNT(DISTINCT Job_No)
FROM MyView
which will return 85, the actual number of jobs.These, of course, would be filtered through Crystal's Record Selection Formulae.
Is there a way to count just the unique records based on a single field?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
DistinctCount was exactly what I was looking for.
Thanks.
Thanks.
SELECT DISTINCT Job_No, Count(Job_No) as JobCount FROM MyView
mlmcc