In a Symfony2 project:
select * from
(
select
p.name as product, u.id, u.name
from user u
left join product_purchase pp on pp.user_id = u.id
left join product p on pp.product_id = pp.product_id
where p.type = 'something'
order by p.id desc
) as up
group by up.id;
This is simplified query I want build with Doctrine Query Builder but couldn't find a solution yet. The important thing is ordering on join before grouping the result. Any help would be much appreciated.
this is a example may help you because vote and check good response. He use a second queryBuilder var in a first qb with $qb->expr()->in(
: subquery in queryBuilder Doctrine