Join JSON array field with string field in mysql
问题 I am looking for records in table 2 whose id exist in the values of nums field (JSON) in table 1. table1 id | nums (JSON) ---+------------------- 1 | ["1","2","3","4"] 2 | ["7","8","5","6"] 3 | ["9","10","3","4"] table2 id | ---+ 1 | 2 | 53 | 63 | I would like to get the next result. rows desired id | ---+ 1 | 2 | I am using 5.7 mysql version. 回答1: If I understand correctly: select t2.id from table2 t2 where exists (select 1 from table1 where json_contains(nums, t2.id) ); You may need to cast