Since this is just a small range of options, another approach with no VBA would be to set up a series of IIF statements and concatenate the results.
SELECT name,
IIF(SUM(IIF(day = "Monday",1,0)) >0, "Monday, ") &
IIF(SUM(IIF(day = "Tuesday",1,0)) >0, "Tuesday, ") &
IIF(SUM(IIF(day = "Wednesday",1,0)) >0, "Wednesday, ") &
IIF(SUM(IIF(day = "Thursday",1,0)) >0, "Thursday, ") &
IIF(SUM(IIF(day = "Friday",1,0)) >0, "Friday, ") &
IIF(SUM(IIF(day = "Saturday",1,0)) >0, "Saturday, ") &
IIF(SUM(IIF(day = "Sunday",1,0)) >0, "Sunday, ") AS AllDays
FROM Table1
GROUP BY name
If you a perfectionist, you could even get rid of the last comma like this
SELECT name,
LEFT(
IIF(SUM(IIF(day = "Monday",1,0)) >0, "Monday, ") &
IIF(SUM(IIF(day = "Tuesday",1,0)) >0, "Tuesday, ") &
IIF(SUM(IIF(day = "Wednesday",1,0)) >0, "Wednesday, ") &
IIF(SUM(IIF(day = "Thursday",1,0)) >0, "Thursday, ") &
IIF(SUM(IIF(day = "Friday",1,0)) >0, "Friday, ") &
IIF(SUM(IIF(day = "Saturday",1,0)) >0, "Saturday, ") &
IIF(SUM(IIF(day = "Sunday",1,0)) >0, "Sunday, "),
LEN(
IIF(SUM(IIF(day = "Monday",1,0)) >0, "Monday, ") &
IIF(SUM(IIF(day = "Tuesday",1,0)) >0, "Tuesday, ") &
IIF(SUM(IIF(day = "Wednesday",1,0)) >0, "Wednesday, ") &
IIF(SUM(IIF(day = "Thursday",1,0)) >0, "Thursday, ") &
IIF(SUM(IIF(day = "Friday",1,0)) >0, "Friday, ") &
IIF(SUM(IIF(day = "Saturday",1,0)) >0, "Saturday, ") &
IIF(SUM(IIF(day = "Sunday",1,0)) >0, "Sunday, ")
) - 2
)
AS AllDays
FROM Table1
GROUP BY name
You may also consider keeping them in separate columns, as this may prove more useful if accessing this query from another. For instance, finding only instances with a Tuesday would be easier this way. Something like:
SELECT name,
IIF(SUM(IIF(day = "Monday",1,0)) >0, "Monday") AS Monday,
IIF(SUM(IIF(day = "Tuesday",1,0)) >0, "Tuesday") AS Tuesday,
IIF(SUM(IIF(day = "Wednesday",1,0)) >0, "Wednesday") AS Wednesday,
IIF(SUM(IIF(day = "Thursday",1,0)) >0, "Thursday") AS Thursday,
IIF(SUM(IIF(day = "Friday",1,0)) >0, "Friday") AS Friday,
IIF(SUM(IIF(day = "Saturday",1,0)) >0, "Saturday") AS Saturday,
IIF(SUM(IIF(day = "Sunday",1,0)) >0, "Sunday") AS Sunday
FROM Table1
GROUP BY name