ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:reference:connection:getmedian

This is an old revision of the document!


getMedian

Syntax
 mixed getMedian {
       mixed string $table
       mixed string $column
       optional mixed string $where
}

Returns the median value of $column for $table, or false if an error occurs.

The $where clause is optional, but if used, the WHERE statement must include the requested column as in “WHERE name > 'A'”. If an error occurs, false is returned.

Usage

/*
 * Assumed database connection in $db
*/
$table = 'zip_codes';
$column = 'population';
 
$medianPopulation = $db->getMedian($table,$column);
v5/reference/connection/getmedian.1452648655.txt.gz · Last modified: 2017/04/21 11:35 (external edit)