1
我有表名details
有contains
字段,它将数组存储在postgres中。原始查询数组字段Postgres Laravel
id | contents
1 | ["1", "2", "5"]
2 | ["4", "2", "10"]
3 | ["3", "5"]
如果我查询5
它应该返回2条记录,即ID 1
和3
其实我是想在laravel实现。
Details::whereRaw("contents ->> $id")->get(); // this doesn't work :p
如何查询原始数据?
我得到这个错误'SQLSTATE [42809]:错误对象类型:7 ERROR:运算ANY/ALL(阵列)需要在右side'我阵已经定义了'json' –