I have this table as input
| Likelihood | Impact | Score |
|---|---|---|
| Very Likely | Minimal | Low |
| Very Likely | Moderate | High |
| Very Likely | Severe | High |
| Likely | Minimal | Low |
| Likely | Moderate | High |
| Likely | Severe | High |
| Possible | Minimal | Low |
| Possible | Moderate | Medium |
| Possible | Severe | High |
| Unlikely | Minimal | Low |
| Unlikely | Moderate | Low |
| Unlikely | Severe | Medium |
| Very Unlikely | Minimal | Low |
| Very Unlikely | Moderate | Low |
| Very Unlikely | Severe | Low |
I was unable to get as my expectation. I am getting NULL values for Minimal and Severe column.
I ran the SQL
SELECT Likelihood, Minimal, Moderate, Severe
FROM
(
SELECT * FROM MYTABLE
) AS S
PIVOT (MAX(Score) for Impact in (Minimal, Moderate, Severe)) AS Pivot_Table
I need output as
| Likelihood | Minimal | Moderate | Severe |
|---|---|---|---|
| Very Likely | Low | High | High |
| Likely | Low | High | High |
| Possible | Low | Medium | High |
| Unlikely | Low | Low | Medium |
| Very Unlikely | Low | Low | Low |
Any suggestions?


