users
表结构如下
id | name | extra |
---|---|---|
1 | 张三 | [ {"path": "http://****/1d17893a-3cff-40ad-8d7d-202e8b473d33.jpg","params": "1","url_type": 1}.{"path": "http://****/1d17893a-3cff-40ad-8d7d-202e8b473d33.jpg","params": "1","url_type": 3}] |
2 | 李四 | [ {"path": "http://****/1d17893a-3cff-40ad-8d7d-202e8b473d33.jpg","params": "1","url_type": 2}] |
3 | 王五 | [ {"path": "http://****/1d17893a-3cff-40ad-8d7d-202e8b473d33.jpg","params": "1","url_type": 3}] |
查找extra
字段中url_type
为1或者3
使用mysql为
SELECT * FROM users WHERE JSON_CONTAINS(JSON_ARRAY(1,3),data->'$[*].url_type')