我正在使用php doctrine,我无法将此sql查询转换为querybuilder。 我有“分组”的问题 有什么帮助吗?
SELECT * FROM message WHERE sender_id ='2'OR receiver_id ='2'Group By(if(sender_id> receiver_id,sender_id,receiver_id)),(if(sender_id< = receiver_id,sender_id,receiver_id))订单BY创建了DESC
这就是我所做的,但我需要在groupby上的条件
$queryBuilder = $this->createQueryBuilder('m');
$queryBuilder->where('m.sender = :user or m.receiver =:user')
->groupBy('m.sender','m.receiver')
->orderBy('m.createdAt', 'Desc')
->setParameter('user', $user);