?
Solved

Selecting distinct/non distinct from same data set

Posted on 2012-04-12
5
Medium Priority
?
477 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 74

Expert Comment

by:sdstuber
ID: 37839569
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
ID: 37839717
Doh, please see it attached and i think you will understand my method..
queries.txt
0
 
LVL 20

Accepted Solution

by:
flow01 earned 2000 total points
ID: 37840239
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
ID: 37842279
Thanks!!
0
 

Author Closing Comment

by:dprasad
ID: 37842286
thanks
0

Featured Post

Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller singl…
One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…

649 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