I have a table with 3 different columns. I need to combine two column values with some special character like comma based on first column value.
There are many examples with similar query but I do not find one with GroupBy and Special Character.
Table looks like this:
Region CountryName ProductID
Latin America/Caribbean BAHAMAS 21
Europe AZERBAIJAN 23
Europe AZERBAIJAN 24
Latin America/Caribbean BAHAMAS 21
Middle East/Africa BAHRAIN 43
Europe BALI 21
Asia Pacific BANGLADHESH 25
Asia Pacific BANGLADHESH 256
Latin America/Caribbean BARBADOS 20
Europe BELARUS 15
Europe BELGIUM 24
Expected result is:
Region CountryName
Latin America/Caribbean BAHAMAS:21,BARBADOS:20
Europe AZERBAIJAN:23,AZERBAIJAN:24,BALI:21,BELARUS:15,BELGIUM:24
Asia Pacific BANGLADHESH:25,BANGLADHESH:256
Middle East/Africa BAHRAIN:43
I could not figure out the query to achieve this. Anybody have an idea on this?