My first CTE have below output. Check CTE output image [1]: https://i.stack.imgur.com/ky0vT.png
LOG_ID Type PROV_NAME RK 100001 Physician DIPCHAND, ANNE 1 100001 Physician ALY, SAFWAT 2 100001 Physician BARRON, DAVID 3 100025 Physician MCVEY, MARK 1 100025 Physician GUARIENTO, ALVISE 2
I need provider name to go in column for same Log ID, but there is no fix number of providers name; it can be 1 or more, dynamic. So I do not want to limit column up to prov_name_3, it should add automatically based on number of providers. I need below output. Check expected output image [1]: https://i.stack.imgur.com/MBJx9.png LOG_ID Type PROV_NAME_1 PROV_NAME_2 PROV_NAME_3 100001 Physician DIPCHAND, ANNE ALY, SAFWAT BARRON, DAVID 100025 Physician MCVEY, MARK GUARIENTO, ALVISE