I have following table in PostgreSQL 11.0
forms
ampoules, capsules, coated tablets, infusion ampoules, liquids, powders, tablets
capsules, coated tablets, powders, tablets, unspecified
coated tablets
I would like to replace certain strings in this comma separated values for each row and get distinct values in the end. For eg. coated tablets by tablets, capsules by tablets, infusion ampoules by ampoules.
The desired output is:
forms_normalized
ampoules, liquids, powders, tablets
tablets, powders, unspecified
tablets
I have no starting point to resolve this issue. Any help is highly appreciated.
Thanks