I am running Postgres 9.6
I have a list of various class codes. Here is:
'What I have' And 'What I Want'
what I have --> what I want.
Equip:Mold --> Equip:Mold
Raw:Resin:TPA --> Raw:Resin
FG --> FG
...
My strategy to accomplish this is to write a user defined function that will find the character count 2nd ':' in my list then use the LEFT
function with a LEFT('Raw:Resin:TPA',nthpositionget('Raw:Resin:TPA',':',2))
I tried using the following question to no avail. Postgres: extract text up to the Nth Character in a String