public function count_field_values($table, string $field = null,  array $where = [], array $order = []){
    if ( \is_array($table) && \is_array($table['fields']) && count($table['fields']) ){
      $args = $table;
      $field = array_values($table['fields'])[0];
    }
    else{
      $args = [
        'tables' => [$table],
        'where' => $where,
        'order' => $order
      ];
    }
    $args = array_merge($args, [
      'kind' => 'SELECT',
      'fields' => [
        'val' => $field,
        'num' => 'COUNT(*)'
      ],
      'group_by' => [$field]
    ]);
    return $this->rselect_all($args);
  }