如果我有两个带有 JSON 数据的表,您能否写信告诉我如何从 MySQL 数据库中进行选择。其中之一具有以下结构:
Table Trees
(id, name, value) - three columns
其中包括以下数据
1, trees, [{"name":"Oaktree","value":1,"target":null},{"name":"Appletree","value":2,"target":null},{"name":"Plumtree","value":3,"target":null}]
2, length, [{"name":"10m","value":1,"target":null},{"name":"15m","value":2,"target":null},{"name":"20m","value":3,"target":null}]
3, age, [{"name":"5y","value":1,"target":null},{"name":"10y","value":2,"target":null},{"name":"20y","value":3,"target":null}]
第二个表的结构如下:
Table SelectedTrees
(properties) - only one column
其中包括以下数据
[{"id":"1","value":["1","3"]},{"id":"2","value":["1", "2", "3"]},{"id":"3","value":["2"]}]
它表示从 Trees 表中选择的数据。selectedTrees中属性列中的id对应于Trees表中的id列。我想从数据库真实(json_decoded)值中进行选择,例如:
树木 = 橡树、李子树
长度 = 10m、15m、20m
年龄 = 10 岁
我怎么能做这个?提前致谢。
简