在线文档教程
PHP

SphinxClient::setGroupBy

SphinxClient::setGroupBy

(PECL sphinx >= 0.1.0)

SphinxClient::setGroupBy — Set grouping attribute

Description

public bool SphinxClient::setGroupBy ( string $attribute , int $func [, string $groupsort = "@group desc" ] )

Sets grouping attribute, function, and group sorting mode, and enables grouping.

Grouping feature is very similar to GROUP BY clause in SQL. Results produced by this function call are going to be the same as produced by the following pseudo code: SELECT ... GROUP BY $func($attribute) ORDER BY $groupsort.

Parameters

attribute

A string containing group-by attribute name.

func

Constant, which sets a function applied to the attribute value in order to compute group-by key.

groupsort

An optional clause controlling how the groups are sorted.

Return Values

Returns TRUE on success or FALSE on failure.

See Also

  • SphinxClient::resetGroupBy

  • SphinxClient::setSortMode

  • SphinxClient::setGroupDistinct

← SphinxClient::setGeoAnchor

SphinxClient::setGroupDistinct →

© 1997–2017 The PHP Documentation Group

Licensed under the Creative Commons Attribution License v3.0 or later.

https://secure.php.net/manual/en/sphinxclient.setgroupby.php