数据库中保存有json数据如下:
例:表 so_custom
id custom_id content
1 1 {"buy":"2","sell":"3","stock":"1,2,3"}
2 4 {"buy":"2","sell":"3","stock":"1,4"}
3 6 {"buy":"2","sell":"3","stock":"1,22,3"}
4 7 {"buy":"2","sell":"3","stock":"1"}
现在只知道 stock中有3,如何通过这个条件去找出相应的custom_id,tp5的查询写法是什么?
这种写法($this->model->json(['content'])->where('content->stock',3)->select())只能在stock =3 的数据,无法找出 stock 包含 1,2,3 的数据,