Already answered by Motta, thanks for your patience.
How can I transpose rows to columns in SQLServer, so that something like this:
Keepthisformat?
With UNION maybe
select 'jan' , jan linhabase from tabela
union
select 'fev' , fev linhabase from tabela
union
...
select 'dez' , dezlinhabase from tabela
But the problem was unclear to me, another thing is what seems like a bad model to me.
Also search for UNPIVOT
A slightly more elegant shape than it was presented, would be to use unpivot
,
select *
from Tabela
unpivot
(
Valor
for Ano in ([Jan], [Fev], [Mar], [Abr], [Mai], [Jun], [Jul], [Dez]) unpiv
order by ano desc
If you want to count the values. Use SUM
Example ..
SELECT sum(Jan), count(Fev), sum(Mar),..... FROM tabela.
Result will be the sum of the rows in the columns in January, February, etc. ...