lava-oushudb-dt-sql-parser/test/parser/spark/syntax/fixtures/selectPivot.sql
Frank d0ad381833
test: spark sql query syntax unit test (#173)
* test: add spark query unit test and check grammar

* test: add select explain、lateralSubQuery、transform unit test

* chore: fileName exchange

---------

Co-authored-by: dilu <dilu@dtstack.com>
2023-10-10 16:25:43 +08:00

7 lines
357 B
SQL

-- 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));