[MDEV-10144] Add support for PIVOT Created: 2016-05-27  Updated: 2023-03-15

Status: Open
Project: MariaDB Server
Component/s: Parser
Fix Version/s: None

Type: Task Priority: Major
Reporter: Michael Widenius Assignee: Unassigned
Resolution: Unresolved Votes: 9
Labels: Compatibility

Issue Links:
Duplicate
duplicates MDEV-12228 SUGGESTION: TRANSACT-SQL LIKE "PIVOT"... Closed
Epic Link: Oracle Compatibility

 Description   

The CONNECT engine support PIVOT.
https://mariadb.com/kb/en/mariadb/connect-table-types-pivot-table-type/

This task is to add native support for PIVOT.

https://technet.microsoft.com/en-us/library/ms177410%28v=sql.105%29.aspx

Syntax:

SELECT <non-pivoted column>,
    [first pivoted column] AS <column name>,
    [second pivoted column] AS <column name>,
    ...
    [last pivoted column] AS <column name>
FROM
    (<SELECT query that produces the data>)
    AS <alias>
PIVOT
(
    <aggregation function>(<column being aggregated>)
FOR
[<column that contains the values that will become column headers>]
    IN ( [first pivoted column], [second pivoted column],
    ... [last pivoted column])
) AS <alias for the pivot table>
<optional ORDER BY clause>;



 Comments   
Comment by Juan Telleria [ 2018-03-12 ]

Is it expected for MariaDB 10.3.6 RC?

Thank you.

Juan

Comment by Barney [ 2022-02-03 ]

Does this include support for UNPIVOT?

The duplicate MDEV-12228 and the Microsoft link explicitly mention unpiviot, but the MariaDB link to to the CONNECT engine does not, and there is no syntax suggestion as there is for PIVOT.

Would be good to clarify.

Comment by Tranner Dig [ 2022-05-09 ]

I would really appreciate this feature, I think it would be useful to many many people.

Thanks,
T.

Comment by antonis [ 2023-03-15 ]

In an analytics era this missing feature makes MariaDb a second class citizen

Generated at Thu Feb 08 07:40:00 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.