CollectionFind::groupBy
(사용 가능한 버전 정보가 없으며 Git에만 있을 수 있음)
CollectionFind::groupBy — 그룹화 기준 설정
설명
public mysql_xdevapi\CollectionFind::groupBy(string $sort_expr
): mysql_xdevapi\CollectionFind
이 함수는 결과 집합을 하나 이상의 열로 그룹화하는 데 사용할 수 있으며 자주 COUNT, MAX, MIN, SUM 등과 같은 집계 함수와 함께 사용됩니다.
매개변수
sort_expr
- 그룹 작업에 사용해야 하는 열 또는 열은 단일 문자열이거나 각 열에 대해 하나씩 문자열 인수의 배열일 수 있습니다.
반환 값
추가 처리에 사용할 수 있는 CollectionFind
Examples
예제 #1 mysql_xdevapi\CollectionFind::groupBy() 예제
<?php
//Assuming $coll is a valid Collection object
//Extract all the documents from the Collection and group the results by the 'name' field
$res = $coll->find()->groupBy('name')->execute();
?>