lava-oushudb-dt-sql-parser/test/parser/spark/syntax/fixtures/selectPivot.sql

7 lines
357 B
MySQL
Raw Normal View History

-- PIVOT ( { aggregate_expression [ AS aggregate_expression_alias ] } [ , ... ]
-- FOR column_list IN ( expression_list ) )
SELECT * FROM person PIVOT (SUM(age) AS a, AVG(class) AS c FOR name IN ('John' AS john, 'Mike' AS mike));
SELECT * FROM person PIVOT (SUM(age) AS a, AVG(class) AS c FOR (name, age) IN (('John', 30) AS c1, ('Mike', 40) AS c2));