Solved

Selecting distinct/non distinct from same data set

Posted on 2012-04-12
5
467 Views
Last Modified: 2012-06-27
Hello. In a call center environment, each call that comes in is placed into an appropriate category. Calls are placed by participants.

The goal is to count how many times the same participant called into the same category within a 15 day period. Those records need to be tabulated, other calcs remain, but this is the hard part.

See attached file for 2 queries. Only difference is that one is distinct, the other is not selecting distinct. If I could somehow subtract the counts from eachother i would get at the needed number. But because it has to be summed as a group with participant, I'm not sure how these could be subtracted. Maybe a sub-select query of some sort?

Thanks for any advice.
0
Comment
Question by:dprasad
  • 3
5 Comments
 
LVL 73

Expert Comment

by:sdstuber
Comment Utility
no queries were attached, but that's ok, don't really need them

please post sample data and expected output
0
 

Author Comment

by:dprasad
Comment Utility
Doh, please see it attached and i think you will understand my method..
queries.txt
0
 
LVL 20

Accepted Solution

by:
flow01 earned 500 total points
Comment Utility
as far as i can see you can combine them

select COUNT(V_CATEGORY.PKEY) AS CATEGORY_COUNT,
       COUNT(distinct V_CATEGORY.PKEY) AS DCATEGORY_COUNT,
       COUNT(V_CATEGORY.PKEY) - COUNT(distinct V_CATEGORY.PKEY) DIF_COUNT,
       V_PARTICIPANT.PKEY AS PART_KEY
FROM
..
0
 

Author Comment

by:dprasad
Comment Utility
Thanks!!
0
 

Author Closing Comment

by:dprasad
Comment Utility
thanks
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
This article explains all about SQL Server Piecemeal Restore with examples in step by step manner.
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now