May 7, 2015 at 9:28 am
I have a table to be grouped based on a field called "category"
The category is based on categories, e.g. if the row has a category of :
LIKE '%PII%' OR
LIKE '%PIPEDA%' OR
LIKE '%HIPAA%' OR
LIKE '%Resume for HR%'
Then the category is called "PII"
if the row has a category of:
LIKE '%PCI%' OR
LIKE '%Cards%'
Then the cagegory is called "PCI DSS"
.....
What I need to finally generate is group by the new categories: PII, [PCI DSS], and so on
How do I write the script? I prefer not to use temp table, if possible.
Thanks
May 7, 2015 at 10:10 am
i think you just put a case in your group, like this:
group by
CASE WHEN [Category]LIKE '%PII%' OR
LIKE '%PIPEDA%' OR
LIKE '%HIPAA%' OR
LIKE '%Resume for HR%'
Then 'PII'
WHEN [Category]LIKE '%PCI%' OR
LIKE '%Cards%'
THEN 'PCI DSS'
ELSE 'Default Category'
END
Lowell
May 7, 2015 at 12:26 pm
Thanks.
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply