I have a custom attribute delivery_date set for my orders however I want to create a collection that groups all these dates together and tells me the order count for each date. I have attempted with something like below and other methods however not having much like in returning anything:
$orders = $this->_orderCollectionFactory->create()->addAttributeToSelect('*')->addFieldToFilter('delivery_date', array('gteq' => $fromDay))->getSelect()->columns(['count' => new \Zend_Db_Expr('COUNT(delivery_date)')])->group('delivery_date');
How can this be achieved?