I have 3 tables (order, product, order_item). As orderI have a date. In order_item, I have product_idand order_id. I need to select all products with orders created in the current month. It is my choice:
$select = $this->select()
->setIntegrityCheck(false)
->from(array('o' => 'order'))
->join(array('oi' => 'order_item'), 'o.id = oi.order_id', array('quantity'))
->joinLeft(array('p' => 'product'), 'p.id = oi.product_id', array('id', 'pbv', 'name'))
->where('MONTH(o.date) = MONTH(CURDATE())');
But when I have no orders, the result is empty. And I always have to have all the products. Sorry for my English. Thank.
source
share