Solved

Combining group results in Reporting Services Part 2

Posted on 2008-06-25
2
192 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 250 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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SSIS GUID Variable 2 32
Find unused columns in a table 12 70
Need help separating values from a column and creating a new record 6 45
help converting varchar to date 14 25
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
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

756 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