Dynamic In Column is supported in MemSql for PIVOT?

Dynamic In Column is supported in MemSql for PIVOT?

Example:

SELECT “Items Produced” AS “Total Production by Day”, Saturday, Sunday
FROM (
SELECT dayOfWeek, itemsProduced
FROM productionHistory
) AS pvt_subquery
PIVOT (
SUM(itemsProduced)
FOR dayOfWeek
IN (select weekday from WeekDays)
) AS pvt_table;

select weekday from WeekDays being dynamic column supply here.

write a quick procedure that will accept an array
a) you can concatenate them to a string to use in dynamic sql
b) load them to a temp table and pass in the dataset id into the dyanamic sql ( use this with larger datasets for join performance)

Look up “execute immediate” in the docs to see how to create and execute dynamic sql