?
Solved

Combining group results in Reporting Services Part 2

Posted on 2008-06-25
2
Medium Priority
?
211 Views
Last Modified: 2010-04-21
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
Comment
Question by:thehollis
[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
2 Comments
 
LVL 12

Accepted Solution

by:
jgv earned 1000 total points
ID: 21867971
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
 

Author Closing Comment

by:thehollis
ID: 31470670
Thank you very much!!!  I am still learning SQL and have not encountered CASE yet...now I will seek it out.
0

Featured Post

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

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

In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

766 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