dianemarie
Instructor
Hello, I want to take this SQL and put it into a calculated field in my report (SSRS 2005). I'm showing customer categories on a report, and they want to take categories that are broken out into several subcategoris and throw them into one category. (Ex: there is Fundraising-Health, Fundraising-Kids, etc. which they want together under "Fundraising".) I have tried Iif, Switch, Instr. They all look OK but when I drop the expression on the report and run the report, the field returns #Error. I see on the internet that doing a public function might help, but I'm unsure how to write it. Category is a varchar 100 field in the table. Any help would be appreciated.
case when account_type like 'fundraising%' then 'Fundraising'
when account_type like 'magazine%' then 'Magazines'
when account_type like 'apparel%' then 'Apparel' else account_type end as cats
case when account_type like 'fundraising%' then 'Fundraising'
when account_type like 'magazine%' then 'Magazines'
when account_type like 'apparel%' then 'Apparel' else account_type end as cats