0
Gentlemen, good morning !
I’m having a little trouble building this query in Microsoft SQL 2019
Could someone maybe give me a light ?
I have a base like this
Codfuncionario | cod_centro_custo | perc_rateio
1 | 1 | 50%
1 | 2 | 50%
2 | 1 | 100%
And I need to dynamically transform it:
codFunctioning | cod_centro_custo_1 | perc_valor1 | cod_centro_custo2 | perc_valor2 ..
1 | 1 | 50% | 2 | 50%
2 | 1 | 100% | NULL | NULL
and what have we already done? ask your current query and where are you struggling
– Ricardo Pontual
Search by PIVOT , https://docs.microsoft.com/pt-br/sql/t-sql/queries/from-using-pivot-and-unpivot?view=sql-server-ver15
– Motta