mysql_xdevapi\TableSelect
PHP Manual

TableSelect::having

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

TableSelect::havingSet select having condition

说明

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

Sets a condition for records to consider in agregate function operations.

参数

sort_expr

A condition on the agregate functions used on the grouping criteria.

返回值

A TableSelect object.

范例

Example #1 mysql_xdevapi\TableSelect::having() example

<?php

$sel 
$table->select(['age as age_group''count(name) as cnt'])->groupBy('age_group');
$sel $sel->where("age > 11 and 1 < 2 and 40 between 30 and 900");
$sel $sel->having('cnt > 1');
$sel $sel->orderBy('age_group desc');
$res $sel->limit(2)->offset(1)->execute();

?>

mysql_xdevapi\TableSelect
PHP Manual