• Status: Solved
  • Priority: High
  • Security: Public
  • Views: 32
  • Last Modified:

Distinct count of Employees

Create a Distinct count of EmpIDs, where there are multiple rows with same EmpID.

What is the proper syntax?

select  DISTINCT COUNT(SCD.BEMSID)
        , SCD.EMPID
        , SCD.FULL_NAME 
        , SCD.DEPT
        , SCD.EFF_FROM_DATE
        , SCD.EFF_TO_DATE
        , SCD.PEOPLE_CHANGE_DATE
        , SCD.SCD_MANAGER_BEMSID 
        , SCD.MANAGER_BEMSID
FROM table1_v SCD
WHERE EFF_TO_DATE >= add_months(TRUNC(SYSDATE, 'YY'),-24)
      AND ORG_STRUCTURE_CD LIKE '1SF%'
     -- AND SCD.SCD_MANAGER_EMPID <> SCD.MANAGER_EMPID
     -- AND EFF_TO_DATE >= add_months(TRUNC(SYSDATE, 'YY'),-24);
GROUP BY SCD.EMPID
        , SCD.FULL_NAME 
        , SCD.DEPT
        , SCD.EFF_FROM_DATE
        , SCD.EFF_TO_DATE
        , SCD.PEOPLE_CHANGE_DATE
        , SCD.SCD_MANAGER_BMPID
        , SCD.MANAGER_EMPID
ORDER BY SCD.FULL_NAME;

Open in new window


What do I need to do to the above query to determine the correct count of EmpID's?

Thanks,

Karen
0
Karen Schaefer
Asked:
Karen Schaefer
1 Solution
 
slightwv (䄆 Netminder) Commented:
Try:
select COUNT( DISTINCT SCD.BEMSID)
0
 
Karen SchaeferBI ANALYSTAuthor Commented:
THANKS
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now