mysql - Group by month using datetime field in zend 2 -


i trying monthly transaction records according location id. wrote following zend query fetch data table. want data grouping according both location id , month. query not grouping in month groups according location id properly. please me resolve issue? thanks.

        $oselect = new select($this->table());         $owhere  = new where();         $owhere->equalto('transaction.location_id',$adataarray['location']);         $oselect->where($owhere);         $oselect->group(array('location_id',new expression('date_format(created_on, "%y-%m")')));         $aresults = $this->gettable()->selectwith($oselect)->toarray(); 


Comments