Closed spearmootz closed 4 weeks ago
Why is this closed? Is it because it's implemented or just won't be?
Because it won't be. That's a really niche feature that wouldn't have much use. Implementing that would also be extremely unsafe since it involves stringifying SQL without using parameters.
example
select * from crosstab('select a,b,c from "table" inner join "table2" on "table1".x = "table2".y') as crosstabAlias
API sample proposal
selectFrom(({ fn, selectFrom }) => fn( "crosstab", selectFrom("table") .select([a, b, c]) .innerJoin("table2", "table1.x", "table2.y") .as("crosstabAlias") ) );
current workaround
selectFrom( sql
select * from crosstab('select a,b,c from "table" inner join "table2" on "table1".x = "table2".y') as crosstabAlias
).select`)....compile()