I am trying to add data from this table to an existing query:
I want to create a column called 'Assertions' and want to only pull in the column names where the value is 'Y'. For example for Control_ID 13009 (first line), the new Assertions column would show:
Control_ID Assertions
13009 'Rights_Obligation, Valuation_Allocation, Existence_Occurence'
I tried using a case when statement like the one below:
case when ca.PRESENTATION_DISCLOSURE = 'Y' then 'Presentation_Disclosure'
when ca.RIGHTS_OBLIGATION = 'Y' then 'Rights_Obligation'
when ca.VALUATION_ALLOCATION = 'Y' then 'Valuation_Allocation'
when ca.COMPLETENESS = 'Y' then 'Completeness'
when ca.EXISTENCE_OCCURRENCE = 'Y' then 'Existence_Occurence'
end as Assertions
This query doesn't work because it's just putting the first assertion with the 'Y' value into the column. How do I modify the query so that it includes all Assertions where the value is 'Y'?
