Results of 1 - 2 of about 2 for stacked (0.001 sec.)
- FILTER Clause 11228
- The FILTER clause may optionally follow an aggregate function in a SELECT statement. This will filter the rows of data that are fed into the aggregate function in the same way that a WHERE clause filters rows, but localized to the specific
...leverage DuckDB's SQL engine for rapid, larger than memory pivoting. First generate an example dataset: CREATE TEMP TABLE stacked_data AS SELECT i, CASE WHEN i <= rows * 0.25 THEN 2022 WHEN i <= rows * 0.5 THEN 2023 WHEN i <= rows * 0.75 THEN 2024 WHEN...i) FILTER (year = 2024) AS "2024", count(i) FILTER (year = 2025) AS "2025", count(i) FILTER (year IS NULL) AS "NULLs" FROM stacked_data; This syntax produces the same results as the FILTER clauses above: SELECT count(CASE WHEN year = 2022 THEN i END) AS...ND) AS "2024", count(CASE WHEN year = 2025 THEN i END) AS "2025", count(CASE WHEN year IS NULL THEN i END) AS "NULLs" FROM stacked_data; 2022 2023 2024 2025 NULLs 25000000 25000000 25000000 12500000 12500000 However, the CASE WHEN approach will not work... - https://man.mtool.work/duckdb/2.0/sql/query_syntax/filter.html
- UNPIVOT Statement 7485
- The UNPIVOT statement allows multiple columns to be stacked into fewer columns. In the basic case, multiple columns are stacked into two columns: a NAME column (which contains the name of the source column) and a VALUE column (which contain
...s to take already pivoted data and re-stack it into a column each for the name and value. In this case, all months will be stacked into a month column and a sales column. UNPIVOT monthly_sales ON jan, feb, mar, apr, may, jun INTO NAME month VALUE sales;... - https://man.mtool.work/duckdb/2.0/sql/statements/unpivot.html
PREV
1
NEXT
DuckDB 2.0 Documentation / man.mtool.work