我想从我的groupBy
表中使用type
字段上的transaction
获取数据。我正在使用此查询
DB::table($this->table)
->select()
->whereRaw($where['rawQuery'], isset($where['bindParams']) ? $where['bindParams'] : array())
->groupBy('type')
->get();
但它没有给complete records
。我的表中有超过10条记录。但它只给了我两个。一个用于type = 1,另一个用于type = 2。它只选择每种类型的记录。我期待我将获得所有基于transactions
的condition
的two result set
。有人知道为什么会这样吗?
试着改为调用Collection
groupBy。只需在get()之后放入groupBy。它应该工作。
DB::table($this->table)
->select()
->whereRaw($where['rawQuery'], isset($where['bindParams']) ? $where['bindParams'] : array())
->get()
->groupBy('type');
常见问题解答::这里( '型', '主机') - >得到() - > GROUPBY( '类');