How to convert SQL to createQueryBuilder?

I have this SQL query:

SELECT row1, row2, row3 FROM messages WHERE condition = '04301' AND row3 IN (SELECT MAX(row3) FROM messages WHERE condition = '04301' GROUP BY row1) GROUP BY row1

I want to use it in symfony, I have seen that it is used: $em->createQueryBuilder();

Something similar to this but with good parameters:

$em->select('data')->from('data')->where('data')->groupBy('data')->setParameter('data');

Can someone help me transform the SQL before to createQueryBuilder() of symfony?

Thanks!

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

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