I want to convert this mysql syntax into a doctrine 1.2 syntax. I want to show dates with zero values and print some errors on it. Also, is PHP foreach loop relevant for this for the templates/views?
SELECT calendar.datefield AS DATE,
IFNULL(SUM(orders.quantity),0) AS total_sales
FROM orders RIGHT JOIN calendar ON (DATE(orders.order_date) = calendar.datefield)
WHERE (calendar.datefield BETWEEN (SELECT MIN(DATE(order_date)) FROM orders) AND (SELECT MAX(DATE(order_date)) FROM orders))
GROUP BY DATE..