略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: CollectionFind::having

2024-11-14

CollectionFind::having

(No version information available, might only be in Git)

CollectionFind::havingSet condition for aggregate functions

说明

public mysql_xdevapi\CollectionFind::having(string $sort_expr): mysql_xdevapi\CollectionFind

This function can be used after the 'field' operation in order to make a selection on the documents to extract.

参数

sort_expr

This must be a valid SQL expression, the use of aggreate functions is allowed

返回值

CollectionFind object that can be used for further processing

范例

示例 #1 mysql_xdevapi\CollectionFind::having() example

<?php

//Assuming $coll is a valid Collection object

//Find all the documents for which the 'age' is greather than 40,
//Only the columns 'name' and 'age' are returned in the Result object
$res $coll->find()->fields(['name','age'])->having('age > 40')->execute();

?>
add a noteadd a note

User Contributed Notes

There are no user contributed notes for this page.

官方地址:https://www.php.net/manual/en/mysql-xdevapi-collectionfind.having.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3