Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
thehollis
Starting Member
4 Posts |
Posted - 2008-06-24 : 15:26:32
|
Is there a way to combine groups that you've set up in a report? For example:I am pulling information that is entered by a form. The 4 possibilities are (blank), Y, N, and P, which has been made into a group to uniformly sort these options with a sum of how many users have each answer:(blank) 10P 20Y 35N 100However, (blank) and N are pretty much the same thing...so I'd like to combine those results like this:N 110P 20Y 35Any help is appreciated! |
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
thehollis
Starting Member
4 Posts |
Posted - 2008-06-24 : 15:50:17
|
SELECT EMPLOYEE, LAST_NAME, FIRST_NAME, DEPARTMENT, PROCESS_LEVEL, TERM_DATE, SCHEDULE, EMP_STATUS, UNION_CODE, AUTO_DEPOSITFROM table.EMPLOYEEWHERE (TERM_DATE = '01-JAN-1700')This is the query I'm using to create a report of 6 demographic views (who is using direct deposit and who isn't). The WHERE statement is to ensure the employee is still active.Thanks! |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-06-25 : 01:39:44
|
quote: Originally posted by thehollis SELECT EMPLOYEE, LAST_NAME, FIRST_NAME, DEPARTMENT, PROCESS_LEVEL, TERM_DATE, SCHEDULE, EMP_STATUS, UNION_CODE, AUTO_DEPOSITFROM table.EMPLOYEEWHERE (TERM_DATE = '01-JAN-1700')This is the query I'm using to create a report of 6 demographic views (who is using direct deposit and who isn't). The WHERE statement is to ensure the employee is still active.Thanks!
What is the field on which you're groupinng on? i.e fields that contains (blank),P,N... |
 |
|
thehollis
Starting Member
4 Posts |
Posted - 2008-06-25 : 09:49:53
|
quote: Originally posted by visakh16
quote: Originally posted by thehollis SELECT EMPLOYEE, LAST_NAME, FIRST_NAME, DEPARTMENT, PROCESS_LEVEL, TERM_DATE, SCHEDULE, EMP_STATUS, UNION_CODE, AUTO_DEPOSITFROM table.EMPLOYEEWHERE (TERM_DATE = '01-JAN-1700')This is the query I'm using to create a report of 6 demographic views (who is using direct deposit and who isn't). The WHERE statement is to ensure the employee is still active.Thanks!
What is the field on which you're groupinng on? i.e fields that contains (blank),P,N...
AUTO_DEPOSIT contains the values (blank), N, Y, and P. Sorry. |
 |
|
chrpeter
Starting Member
31 Posts |
Posted - 2008-06-25 : 10:20:29
|
You could create a calculated variable in the dataset and if AUTO_DEPOSIT is (blank) or N set have it return N, otherwise return the value.=IIF(AUTO_DEPOSIT = "" OR AUTO_DEPOSIT = "N", "N", AUTO_DEPOSIT)Then group on this new variable. |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-06-25 : 13:46:45
|
or created the calaculated member in query itself.like:-SELECT EMPLOYEE, LAST_NAME, FIRST_NAME, DEPARTMENT, PROCESS_LEVEL, TERM_DATE, SCHEDULE, EMP_STATUS, UNION_CODE, AUTO_DEPOSIT,CASE WHEN AUTO_DEPOSIT IN('N','(blank)') THEN 'N' ELSE AUTO_DEPOSITEND AS groupfieldFROM table.EMPLOYEEWHERE (TERM_DATE = '01-JAN-1700') and use this in place where you currently group by AUTO_DEPOSIT |
 |
|
|
|
|
|
|