Symfony Distinct On date_trunc

Hi i have a problem i want use symfony doctrine for my request in native SQL it works but i want make it in doctrine. I use symfony4

I have create custom DQL date_trunc and register

What i want to do is that :

DISTINCT ON (date,ipp.link) date_trunc('day', ip.date) AS date

I have try this one

$qb->select("i,COUNT(DISTINCT CONCAT(date,ipp.link)  date_trunc('day',ip.date) as date) AS maxScore");

but not work

say :

 "[Syntax Error] line 0, col 31: Error: Expected '.' or '(', got 'date'"}

When i test without CONCAT just DISTINCT(date,ipp.link) i got this:

Expected Doc…ineORMQueryLexer::T_CLOSE_PARENTHESIS, got ','"}

I think problem is cause on native it s DISTINCT ON and here it s DISTINCT CONCAT but don t know how do that in doctrine

Someone can help me ?

Thanks

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

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