You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-- [ LeetCode ] 2253. Dynamic Unpivoting of a Table
CREATE PROCEDURE UnpivotProducts()
BEGIN
SET SESSION group_concat_max_len = 1000000;
SET @prepared_stmt = NULL;
SELECT GROUP_CONCAT(CONCAT('SELECT product_id, "', column_name, '" AS store, ', column_name, ' AS price FROM Products WHERE ', column_name, ' IS NOT NULL') SEPARATOR ' UNION ') INTO @prepared_stmt