code: function aggregation($function){
          $join  = $this->createJoins(implode(",", $this->conditions) . ",$function");
          $query = "SELECT $function FROM $this->table" . implode($join);
          if($this->where){
              $query .= " WHERE " . implode($this->where);
          }
  
          foreach($this->query($query, $this->parameters)->fetch() as $return){
              return $return;
          }
      }
docs: Execute aggregation function
  
  @param string $function
  
  @return string