I need your help on Postgresql query logic
Say I have a Table
Environment Info: AWS Aurora Postgresql db 10.6.x
CREATE TABLE test_table
(id character varying(50)
name character varying(128)
original_value ARRAY
);
Table with values
id name original_value
O1S000000000301 Screw {metal_fabtication_c,cabinetery_andor_shelves_c,table_c}
O1S000000000302 wrench {carpentry_c,handyman_c}
O1S000000000303 impact_driver {carpentry_c,masonry_c,handyman_c}
Transformed_value is not a table but it has Name and its corresponding Transformation as below
Name Value
metal_fabrication_c Metal Fabrication
cabinetry_andor_shelves_c Cabinetry/Shelving
handyman_c Handyman
carpentry_c Carpentry
masonry_c Masonry
table_c Furniture
I have to Write a Query in which Original_value should get this equivalent transformed_Value.
SELECT id, name, original_value as transformed_value
FROM test_table
WHERE id IN('O1S000000000301','O1S000000000302','O1S000000000303')
The result should be the following
id name transformed_value
O1S000000000301 Screw Metal Fabrication,Cabinetry/Shelving,Furniture
O1S000000000302 wrench Carpentry,Handyman
O1S000000000303 impact_driver Carpentry,Masonry,Handyman

'Metal Fabrication'come from?