You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SELECT*FROM (select*from monthly_sales)
PIVOT(SUM(amount) FOR MONTH IN (select distinct month from monthly_sales))
ORDER BY EMPID;
If I use a view, databend can support subquey in from:
createviewv_monthly_salesasselect*from monthly_sales;
SELECT*FROM v_monthly_sales
PIVOT(SUM(amount) FOR MONTH IN ('JAN', 'FEB', 'MAR', 'APR'))
ORDER BY EMPID;
Assuming all months are in the results and need to be used, how can I do the query correctly without writing a for?
Are you willing to submit PR?
Yes I am willing to submit a PR!
The text was updated successfully, but these errors were encountered:
@sundy-li
If databend have supported from or in statements with pivot, then normal people use the habit of writing regular sql with subquery.
Without supporting it, I think the usability of this feature is really low. In fact, a lot of data processing is based on the data dynamic execution. Or to put it another way, will this subquery be considered for support in the future?
Search before asking
Version
v1.2.615
What's Wrong?
pivot does not support subquery
How to Reproduce?
referenced document: https://docs.databend.com/sql/sql-commands/query-syntax/query-pivot
error sql:
If I use a view, databend can support subquey in from:
Assuming all months are in the results and need to be used, how can I do the query correctly without writing a for?
Are you willing to submit PR?
The text was updated successfully, but these errors were encountered: