i’m really struggling on this one :
I have some extradata in a postgresql db in which a number matters.
Exemple:
{"code_partenaire":"welcome","sous_statut_abc":"1","statut_alpha":"blabla"}
{"code_partenaire":"code33","sous_statut_def":"1782","statut_alpha":"blablabla"}
{"code_partenaire":"222","sous_statut_ghei":"17","statut_alpha":"blablaa"}
I would like to extract the character between
","statut_alpha"
and its previous ":"
Because there is the number i’m looking for.
Do you have an idea ?
Output should be
- 1
- 1782
- 17
Thanks for your help 🙂
2
Answers
Found it out :)
For the output you given , the substring is tedious process , with the conditions
(1) before : ","statut_alpha"
for this used the reverse string and find the last position of ":"
(2) after the last ":" before ","statut_alpha"
OUTPUT:
if the first condition is always in the third position in the string
you can use the unest with ordinally give rownumber and filter with it
OUTPUT 2 :