[英]How to extract values from column of mysql table having partial Json array values and remaining with string values
Names of these 3 columns were Date, TargetName, Amount.这 3 列的名称是 Date、TargetName、Amount。 TargetName column has partial rows with json array values and remaining rows with strings.
TargetName 列的部分行包含 json 数组值,其余行包含字符串。
I want to extract value[0] from json array.我想从 json 数组中提取 value[0] 。 With condition like [case when (targetName is Json type) Then $.value[0] else targetName] How to apply this condition and get the expected result?
条件类似 [case when (targetName is Json type) Then $.value[0] else targetName] 如何应用此条件并获得预期结果?
Expected outcome: TargetName预期结果:目标名称
SSC Stenographer SSC速记员
UP Police Sub Inspector UP警察副督察
UPRVUNL JE上扬JE
AAI JE Technical AAI JE 技术
ACC Exam ACC考试
SELECT CASE WHEN JSON_VALID(TargetName)
THEN TargetName ->> "$[0].value"
ELSE TargetName
END AS TargetName ,
...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.