关于#mysql#json查询的问题:

表1

img


表2

img

目标
1.通过表二中的inlude_days 检索 当天 的 student_ids
2.再通过结果查询表1中包含的学生

用 FIND_IN_SET可以实现,这是例子
SELECT FIND_IN_SET('b', 'a,b,c,d')

我 用 select * from customer_per_student where JSON_CONTAINS((select student_ids from customer_empower where JSON_CONTAINS(include_days,JSON_ARRAY(date_format(now(),'%Y/%m/%d')))),id);
没结果

还是 自己解决了
select id from customer_per_student where (select count(*) from customer_empower where json_search(student_ids,'one',customer_per_student.id) is not null and JSON_CONTAINS(include_days,JSON_ARRAY(date_format(now(),'%Y/%m/%d')))) >0;