I have a data structure like below:
Products
| _id | name | available_in_region_id |
-----------------------------------------
| d22 | shoe | c32, a43, x53 |
| t64 | hat | c32, f42 |
Regions
| _id | name |
---------------------
| c32 | london |
| a43 | manchester |
| x53 | bristol |
| f42 | liverpool |
I want to look up the array of "available_in_region_id" ids and replace them by the region name to result in a table like below:
| _id | name | available_in_region_name |
----------------------------------------------
| d22 | shoe | london, manchester, bristol |
| t64 | hat | london, liverpool |
What is the best way to do this using standard SQL?
Thanks,
A