I have a measure_value::varchar that is say [32603072,20213608,1314736] and named memory.
How would I select the 1st element of that array only ?
I have a measure_value::varchar that is say [32603072,20213608,1314736] and named memory.
How would I select the 1st element of that array only ?
You can use a combination of string functions to convert into array, like
Then you can use normal array operators. Example here
select my_array[1] from (
select
split(replace(replace(my_string,'[',''),']',''), ',') as my_array
from (
select '[32603072,20213608,1314736]' as my_string
)
)
Result:
| 32603072|
to make replace simpler, maybe you also can try regexp_replace() to remove the brackets first, but I am not too familiar how to write this expression