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
  • 9,606
  • 9
  • 60
  • 93
user1239299
  • 594
  • 7
  • 23

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
  • 24,722
  • 7
  • 100
  • 106