I’m trying to do that query :

SELECT DISTINCT p.reference,, p.range_id 
FROM reference as r INNER JOIN product as p 
WHERE p.reference =;

which will return a single reference name of a table.
I tried with createQueryBuilder

return $this->createQueryBuilder('p')
            ->select('p.reference,,, p.price')->distinct('')
            ->join(Reference::class, 'r', 'WITH', 'p.reference =')

and it returns a result but not what I expected. It actually show a result that looks like a SELECT * FROM etc.

I tried a GroupBy by looking at other topics which makes no sense, it doesn’t work anyway.

Thank you for your help !

Source: Symfony4 Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *