I'm trying to get a correlation matrix in SQL Server and my data is in a table the following way:
RptLOB1 RptLOB2 Correlation
AE AE 1
Bail AE 0.35
Commercial Bail 0.25
Commercial AE 0.15
...and so on.
I want to write a code so my output looks the following way:
AE Bail Commercial
AE 1 0.35 0.15
Bail 0.35 1 0.25
Commercial 0.15 0.25 1
Order of the RptLOB doesn't matter as long as the order is the same from top to bottom and left to right on top. I've been trying to find a way to approach this and I'm not quite sure what the best way is. I was thinking using PIVOT but that will not output the RptLOB's on top (they will be considered as columns in the table).
EDIT:
This output is going to be inserted in another table like so:
col1 col2 col3 col4 col5
Generic
Company Inputs Insurance Stochastic Model Correlations Exposure Correlation Matrix
AE Bail Commercial
AE 1 0.35 0.15
Bail 0.35 1 0.25
Commercial 0.15 0.25 1