• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 220
  • Last Modified:

Combining group results in Reporting Services Part 2

I am creating a report that displays multiple demographics of employees who do or do not utilize direct deposit.   One of the groups (UNION_CODE) returns 6 items: (NULL), Union1, Union2, Union3-Service, Union3-Skilled, Union3-Tech and then reports how many in each group has direct deposit, does not have direct deposit, or partially uses direct deposit.

I've been asked to combine the results to show only 3 groups:

1. Union1
2. Union3 (Service, Skilled, & Tech)
3. "Everyone else" ((NULL) and Union2)

Any ideas on how to do this either in the SQL query dataset or in the report layout (or anywhere else)?
SELECT        EMPLOYEE, LAST_NAME, FIRST_NAME, DEPARTMENT, 
                         PROCESS_LEVEL, TERM_DATE, SCHEDULE, EMP_STATUS, 
                         UNION_CODE, "COALESCE"(AUTO_DEPOSIT, 'N') 
                         AS AUTO_DEPOSIT
FROM            LAWSON.EMPLOYEE
WHERE        (TERM_DATE = '01-JAN-1700')

Open in new window

0
thehollis
Asked:
thehollis
1 Solution
 
jgvCommented:
SELECT      EMPLOYEE, LAST_NAME, FIRST_NAME, DEPARTMENT,
      PROCESS_LEVEL, TERM_DATE, SCHEDULE, EMP_STATUS,
      UNION_CODE, COALESCE(AUTO_DEPOSIT, 'N') AS AUTO_DEPOSIT,
      CASE
          WHEN UNION_CODE = 'Union1' THEN 'Union1'    
          WHEN UNION_CODE LIKE 'Union3%' THEN 'Union3'
          WHEN UNION_CODE IS NULL OR UNION_CODE = 'Union2' THEN 'Everyone Else'
      END AS UnionCodeGrouping
FROM            LAWSON.EMPLOYEE
WHERE        (TERM_DATE = '01-JAN-1700')
0
 
thehollisAuthor Commented:
Thank you very much!!!  I am still learning SQL and have not encountered CASE yet...now I will seek it out.
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

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