I need to allow multi select on a column where the values are all CSV. I had been using a LIKE
statement and a single select parameter but I need the parameter to allow multiselect. An idea I had was to create columns for each of the parameter values (there are only 6) and then use a CASE
statement to set them to True/False and then I was thinking if Type A
is selected, then it will look at ColumnA
and if they also select Type B
then it will also look at ColumnB
.
The entire query is very large, but here's the excerpt I'm working on
CASE WHEN T1.Types LIKE '%Type A%' THEN 1 ELSE 0 END AS TypeA
This is in a CTE, in my final select statement it references TypeA
only, etc. The final query should be something like this
SELECT ID, Types, TypeA, TypeB, TypeC
FROM TableA
WHERE Types IN [parameter]
Here's some sample data for the Types column.
|________Types________|
| TypeA |
| TypeA, TypeC |
| TypeA, TypeB, TypeC |
How can I get this to work without making this too complicated? I know this could easily work if I wanted 6 different parameters for each of the Types and then just had a True/False for each one, but how can I just make it a multiselect with a single parameter?