英文:
JSON Status Extract - Metabase SQL query
问题
我正在尝试提取“outgoing” JSON 字段中冒号后面的值,即“processing”和“cancelled”。
英文:
i have this table in metabase
id | status | outgoing |
---|---|---|
1 | paid | {"a945248027_14454878":"processing"} |
2 | unpaid | {"old.a945248027_14454878":"cancelled"} |
i am trying to extract the value after colon in the "outgoing" json field i.e processing, cancelled"
答案1
得分: 0
你可以使用 substring
from
来实现:
select id, status, substring(outgoing::varchar from '':"([a-z]*)' )
from mytable t
英文:
You can do it using substring
from
:
select id, status, substring(outgoing::varchar from ':"([a-z]*)' )
from mytable t
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论