2016-08-09 2 views
0

내가 가진CakePHP의

SELECT count(id),DATE_FORMAT(created,'%M') from searches group by month(created) 

내가

아래와 같이 CakePHP를 찾기 방법이 쿼리를 적용 내가

count(id) DATE_FORMAT(created,'%M') 
16    August 
2    September 

같이있어 출력 같은 쿼리

$total = $this->Searches->find('count',[ 
      'fields'=>['Searches.id',DATE_FORMAT('created','%M')], 
      'group' =>[month('Searches.created')] 
]); 

첫 번째 오류가 발생합니다. date_format()은 매개 변수 1을 필요로합니다. 어떻게 cakephp에서 최상위 SQL 쿼리를 적용 할 수 있습니까? find 방법? cakephp 3 버전을 사용하고 있습니다.

답변