should be it
This commit is contained in:
28
external/duckdb/test/sql/pivot/pivot_generated.test
vendored
Normal file
28
external/duckdb/test/sql/pivot/pivot_generated.test
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
# name: test/sql/pivot/pivot_generated.test
|
||||
# description: Test pivot over generated columns
|
||||
# group: [pivot]
|
||||
|
||||
statement ok
|
||||
PRAGMA enable_verification
|
||||
|
||||
statement ok
|
||||
CREATE TABLE Product(DaysToManufacture int, StandardCost int GENERATED ALWAYS AS (DaysToManufacture * 5));
|
||||
|
||||
statement ok
|
||||
INSERT INTO Product VALUES (0), (1), (2), (4);
|
||||
|
||||
query IIIIII
|
||||
SELECT 'AverageCost' AS Cost_Sorted_By_Production_Days,
|
||||
"0", "1", "2", "3", "4"
|
||||
FROM
|
||||
(
|
||||
SELECT DaysToManufacture, StandardCost
|
||||
FROM Product
|
||||
) AS SourceTable
|
||||
PIVOT
|
||||
(
|
||||
AVG(StandardCost)
|
||||
FOR DaysToManufacture IN (0, 1, 2, 3, 4)
|
||||
) AS PivotTable;
|
||||
----
|
||||
AverageCost 0.0 5.0 10.0 NULL 20.0
|
||||
Reference in New Issue
Block a user