1

I need to convert the following code to doctrine but cant seem to find the right Doctrine2 function.

Select 
ProductName,
WeekNumber,
sum(sale)
from
(
    SELECT 
    ProductName,
    DATEDIFF(week, '2011-05-30', date) AS WeekNumber,
    sale
    FROM table
)
GROUP BY
ProductName,
WeekNumber

Thank you

A.L
  • 10,259
  • 10
  • 67
  • 98
user1239299
  • 665
  • 8
  • 26

1 Answers1

1

Doctrine 2 ORM does not support subqueries in the FROM clause. The only allowed locations for a subquery are the WHERE and the HAVING clauses, which are supported by the various RDBMS vendors.

Please check the complete EBNF of DQL

Ocramius
  • 25,171
  • 7
  • 103
  • 107