【发布时间】:2022-01-17 14:16:33
【问题描述】:
$qb = $this->createQueryBuilder('o')
->select('u.id as user_id', 'u.username as username', 'u.companyName', 'month(o.checkedAt) as month', 'identity(l.productCategory) as product_category',
'a.street', 'a.zip', 'a.apartmentNo', 'a.city', 'a.streetNo')
->join(User::class, 'u', Join::WITH, 'o.user = u')
->join(UserAddress::class, 'a', Join::WITH, 'u.id = a.user')
->join(OrderLens::class, 'l', Join::WITH, 'l.order = o.id')
->groupBy('o.user')
->addGroupBy('month');
[...]
我收到通知:未定义索引:月 如何按这两个变量对记录进行分组? 没有 ->groupBy('month') 它可以 100% 正确工作
【问题讨论】:
-
我想按这个值分组:'month(o.checkedAt) as month'