I have a table with the following data.
ID Name DiscountGroup Discount DicountCategory
A XXX G025 25 MANGMNT
A XXX T005 5 HIGH GPA
A XXX T010 10
B XXXB G040 40 SOMETXT
B XXXB T005 5 HIGH GPA
I want to display the data as
ID Name PermanentDiscount Cateogry TempDiscount
A XXX 25 MANGMNT 15
B XXXB 40 SOMETXT 5
i.e Permanent and Temporary Discounts in 1 row. All Permanent discount starts with GXXX followed by 3 digits. Similaryly all temporary discount starts with TXXX followed by 3 digits where XXX refers the actual discount. One ID can have multiple temporary discount but only one permanent discount. I tried using
SELECT *
FROM tableA
PIVOT (
MAX(Discount) FOR DiscountGroup IN ('')
);
but am not able to figure out the value of in list.