-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
PIVOT
Example 1. Simple Pivot
SELECT * FROM (
SELECT ID, import, status FROM mytable
) PIVOT (SUM(import) FOR status in ('Authorized', 'Rejected'));Example 2. Pivot w/ Multi-columns Aggregation
WITH initTable AS (
-- put sample data here
),
pivotTable AS (
SELECT * FROM initTable
PIVOT (
MAX(total) total, ANY_VALUE(name) name
FOR fecData IN ('202301', '202302', '202303')
)
)
SELECT * FROM pivotTable;Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels