David C
asked on
Get column name(s) based on value
Hi Experts, I have a table with practice days for a team. I want to run a query that returns a comma separated string of the days. So for the image below, the required result is "Mondays, Thursdays, Fridays"
My current query is;
But it only returns the first true value. If there is a neater way of doing it, that would be great too.
My current query is;
Select [Team Name],[Captain],
Case 'True'
when Monday then 'Mon'
when Tuesday then 'Tue'
when Wednesday then 'Wed'
when Thursday then 'Thu'
when Friday then 'Fri'
End
FROM Practice
where id=11
But it only returns the first true value. If there is a neater way of doing it, that would be great too.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER