从多个文件输入中读取JSON数据

时间:2014-06-26 06:13:08

标签: mysql json

表格帮助

ID    Name
1     Name1
2     Name2

JSON1 = {name:Name1,data:"data1"}
JSON2 = {name:Name2,data:"data2"}

最终输出表

data    reference
JSON1   1
JSON2   2

我希望mysql中的最终输出表引用Table帮助并存储来自JSON1和JSON2的数据

1 个答案:

答案 0 :(得分:0)

SELECT "JSON1" AS data,
       ID AS reference
FROM Table
WHERE JSON1 LIKE CONCAT('{name:', Name, ',data:%}')
UNION
SELECT "JSON2" AS data,
       ID AS reference
FROM Table
WHERE JSON2 LIKE CONCAT('{name:', Name, ',data:%}')