Mysql 如何选择其值位于json数组中的列
总之,我想Mysql 如何选择其值位于json数组中的列,mysql,sql,arrays,json,Mysql,Sql,Arrays,Json,总之,我想 从test.population中选择*,其中数字位于(1,2,3),, 但是在(1,2,3)的位置,我想要一个返回json数组的函数。所以我想让它像这样工作 select * from test.population where Number in ('[1,2,3]') 如何将json数组放入where it子句?您可以使用以下运算符: Number member of ('[1,2,3]') 您可以使用JSON\u SEARCH()。它从MySQL 5.7开始提供,而MyS
从test.population中选择*,其中数字位于(1,2,3)
,,
但是在(1,2,3)的位置,我想要一个返回json数组的函数。所以我想让它像这样工作
select * from test.population where Number in ('[1,2,3]')
如何将json数组放入where it子句?您可以使用以下运算符:
Number member of ('[1,2,3]')
您可以使用
JSON\u SEARCH()
。它从MySQL 5.7开始提供,而MySQL 8.0附带了()的MEMBER
:
select * from test.population where json_search('[1,2,3]', 'one', number) is not null
样本数据和预期结果集会更好。