Separate records
How to retrieve distinct data from a table ?
Each collector can call the method getDistinct that allows you to retrieve the distinct data of a field, with or without conditions.
function getDistinct($field, $conditions = array()) { }
Settings
- $field : corresponds to the field for which you wish to retrieve the distinct values
- $conditions : a table which includes the conditions of recovery
Example
The following example allows you to retrieve the distinct values of the column "ex_type" the collector "example"
$rows = $this->collector['example']->getDistinct('ex_type', array('is_valid' => 1));<br />
The function's return
This method returns an array containing the distinct values
<span>Array
(
[0] =<span class="entity"><span>></span></span> Array
(
[ex_type] =<span class="entity"><span>></span></span> EX1
)
[1] =<span class="entity"><span>></span></span> Array
(
[ex_type] =<span class="entity"><span>></span></span> EX2
)
)</span><br />