Solved

Combining group results in Reporting Services Part 2

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

How to increase the row limit in Jasper Server.
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
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

762 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now