db\Query average()

average() public method Returns the average of the specified column values. public mixed average ( $q, $db = null )$q string The column name or expression. Make sure you properly quote column names in the expression. $db yii\db\Connection The database connection used to generate the SQL statement. If this parameter is not given, the db application component will be used. return mixed The average of the specified column values.

db\Query andWhere()

andWhere() public method Adds an additional WHERE condition to the existing one. The new condition and the existing one will be joined using the 'AND' operator. See also: where() orWhere() public $this andWhere ( $condition, $params = [] )$condition string|array|yii\db\Expression The new WHERE condition. Please refer to where() on how to specify this parameter. $params array The parameters (name => value) to be bound to the query. return $this The query object itself

db\Query andHaving()

andHaving() public method Adds an additional HAVING condition to the existing one. The new condition and the existing one will be joined using the 'AND' operator. See also: having() orHaving() public $this andHaving ( $condition, $params = [] )$condition string|array|yii\db\Expression The new HAVING condition. Please refer to where() on how to specify this parameter. $params array The parameters (name => value) to be bound to the query. return $this The query object itself

db\Query andFilterCompare()

andFilterCompare() public method (available since version 2.0.8) Adds a filtering condition for a specific column and allow the user to choose a filter operator. It adds an additional WHERE condition for the given field and determines the comparison operator based on the first few characters of the given value. The condition is added in the same way as in andFilterWhere() so empty values are ignored. The new condition and the existing one will be joined using the 'AND' operator. The compari

db\Query all()

all() public method Executes the query and returns all results as an array. public array all ( $db = null )$db yii\db\Connection The database connection used to generate the SQL statement. If this parameter is not given, the db application component will be used. return array The query results. If the query results in nothing, an empty array will be returned.

db\Query addSelect()

addSelect() public method Add more columns to the SELECT part of the query. Note, that if select() has not been specified before, you should include * explicitly if you want to select all remaining columns too: $query->addSelect(["*", "CONCAT(first_name, ' ', last_name) AS full_name"])->one(); See also select(). public $this addSelect ( $columns )$columns string|array|yii\db\Expression The columns to add to the select. See select() for more details about the format of this param

db\Query addParams()

addParams() public method Adds additional parameters to be bound to the query. See also params(). public $this addParams ( $params )$params array List of query parameter values indexed by parameter placeholders. For example, [':name' => 'Dan', ':age' => 31]. return $this The query object itself

db\Query addGroupBy()

addGroupBy() public method Adds additional group-by columns to the existing ones. See also groupBy(). public $this addGroupBy ( $columns )$columns string|array Additional columns to be grouped by. Columns can be specified in either a string (e.g. "id, name") or an array (e.g. ['id', 'name']). The method will automatically quote the column names unless a column contains some parenthesis (which means the column contains a DB expression). Note that if your group-by is an expression contai

db\Query $union

$union public property This is used to construct the UNION clause(s) in a SQL statement. Each array element is an array of the following structure: query: either a string or a yii\db\Query object representing a query all: boolean, whether it should be UNION ALL or UNION public array $union = null

db\Query $selectOption

$selectOption public property Additional option that should be appended to the 'SELECT' keyword. For example, in MySQL, the option 'SQL_CALC_FOUND_ROWS' can be used. public string $selectOption = null