New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crosstabs in SELECT [CORE1738] #2161
Comments
Commented by: @dyemanov Unfortunately, this is against the whole FB architecture. By design, the result set width is fixed at the moment of prepare. |
Commented by: @asfernandes The MSSQL PIVOT defines fixed columns. So we can implement it in the same manner. |
Commented by: Pabloj (pabloj_sourceforge) Should be closed as duplicate of CORE650 |
Commented by: Luke (lplatypus) Oracle 11g also introduced a PIVOT clause like what was introduced in MSSQL 2005 MSSQL 2005 docs: http://msdn.microsoft.com/en-us/library/ms177410.aspx This is not a duplicate of CORE650 (SELECT ... GROUP BY ... WITH CUBE) as that query does not directly produce a cross table (though it was a common way to gather the data required to build a cross table prior to the introduction of the PIVOT syntax). |
Commented by: Ivan (patuljak) postgresql has Crosstab example from postgresql create table sales(year int, month int, qty int); select * from crosstab( |
Commented by: @asfernandes Current (3.0) external procedures allows the creation of (very) similar feature as showed by Ivan. |
Commented by: Marcin (wodzu) I was hoping that this feature will be implemented in 3.0. "PIVOT" has a crucial meaning in structures like EAV: http://en.wikipedia.org/wiki/Entity%E2%80%93attribute%E2%80%93value_model Adriano I do not see how external procedures would help in creating such result set, will they allow to return different number of columns each time they are called? |
Commented by: @asfernandes If I may recommend you something, I'd say stay away from EAV. ;) PIVOT (as in Oracle) is defined when a query is compiled. It may not change the columns depending on the data. Re. external procedures, you'd need to define an external procedure for each query (result columns), while may passing the same external procedure name for each of them. External procedures can inspect the object metadata being called and known what columns (output parameters) were declared. |
Submitted by: @WarmBooter
Votes: 18
I receive many questions about "crosstabs" support in Firebird (mostly from people coming from SQLServer or Microsoft Access). Afaik, ANSI SQL doesn't defines any syntax for crosstabs while Microsoft databases uses PIVOT.
As BI and Data Mining applications are becoming more and more common every day, it would be good to have Firebird's select syntax extended to support crosstabs easily.
The text was updated successfully, but these errors were encountered: