Eu tenho a seguinte entrada em um campo JSON no MySQL, como posso acessar os dados wid_1 -> pct_usage?
{ "wid_1": { "cof": 1, "pct_usage": 50.0, "tid": 69285334, "wid": 1 }, "wid_2": { "cof": 1, "pct_usage": 50.0, "tid": 69285335, "wid": 2 } }
Eu tentei várias variações de:
json_unquote(json_extract(s.`col_name`,'$.wid_1'.'pct_usage')) as wid_1_pct,
json_unquote(json_extract(s.`col_name`,'$.wid_1','pct_usage')) as wid_1_pct,
json_unquote(json_extract(s.`col_name`,'$.wid_1'{'pct_usage'})) as wid_1_pct,
json_unquote(json_extract(s.`col_name`,'$.wid_1','{pct_usage}')) as wid_1_pct,
mas nenhum deles funciona.
Este funciona para mim:
https://www.db-fiddle.com/f/466NTsurpc9YKbrbQ5LvaB/0