Symfony Distinct On date_trunc

  doctrine, doctrine-query, postgresql, symfony, symfony4

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, date_trunc('day', AS date

I have try this one

$qb->select("i,COUNT(DISTINCT CONCAT(date,  date_trunc('day', 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, 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 ?


Source: Symfony Questions