Decode comma separated IDs to names

Hi,
   We are on Postgres 9.6
I have a table Customer that has these fields:

ID          Rel_Id
10            12, 23, 34

Then there is this Relation table, that has this structure

Rel_id           Rel_name
12                  Mike
23                  Dave
34                  Jim

I want to show the output as:
ID           Rel_ID                       Rel_Name
10       12,23,34                      Mike, Dave, Jim

Can someone please help?
pvsbandiAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

pvsbandiAuthor Commented:
To add, the Rel_Id field in the Customer table is varchar(255) field
0
pvsbandiAuthor Commented:
Nevermind, I got it.

   First i have used Unnest(String_to_Array(Rel_ID,','))  AS Rel_ID FROM Customer, to turn comma separated values to rows
Then, i have joined this to the Relation table on Rel_ID and did a STRING_AGG on Relation.Rel_Name.
0
pvsbandiAuthor Commented:
I add my comments in the prior comments section on how i got the solution.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PostgreSQL

From novice to tech pro — start learning today.