@param Select $select
@param string $tableAlias
@param bool   $isAsc

@return void
@throws InvalidOperationException
329399
public function addOrderByToSelect(Select $select, string $tableAlias, bool $isAsc)
    {
        $this->addOrderBy($select, $this->getExpressionInSelect($select, $tableAlias), $isAsc);
    }
508146
private void selectExpressions(ParserString raw, Select select) throws SQLParserException {
	Expression exp = null;
	do {
	    raw.removeSpace();

	    exp = expression(raw);
	    if (exp == null) throw new SQLParserException("missing expression in select part of query");
	    raw.removeSpace();
	    if (raw.forwardIfCurrent("as ")) {
		String alias = identifier(raw, new RefBooleanImpl(false));
		if (alias == null) throw new SQLParserException("missing alias in select part");
		exp.setAlias(alias);
	    }
	    else {
		int start = raw.getPos();
		RefBoolean hb = new RefBooleanImpl(false);
		String alias = identifier(raw, hb);
		if (!hb.toBooleanValue() && "from".equalsIgnoreCase(alias)) raw.setPos(start);
		else if (alias != null) exp.setAlias(alias);
	    }
	    select.addSelectExpression(exp);
	    raw.removeSpace();
	}
	while (raw.forwardIfCurrent(','));

    }
986015
public function select($select, $distinct = null)
    {
        if (null !== $distinct) {
            $this->distinct($distinct);
        }

        if (empty($select)) {
            return $this;
        }

        $builder = $this->getLookupBuilder();
        $parts = [];
        if (is_array($select)) {
            foreach ($select as $key => $part) {
                if (is_string($part)) {
                    $newSelect = $builder->buildJoin($this, $part);
                    if ($newSelect) {
                        list($alias, $column) = $newSelect;
                        $parts[$key] = $alias.'.'.$column;
                    } else {
                        $parts[$key] = $part;
                    }
                } else {
                    $parts[$key] = $part;
                }
            }
        } elseif (is_string($select)) {
            $newSelect = $builder->buildJoin($this, $select);
            if ($newSelect) {
                list($alias, $column) = $newSelect;
                $parts[$alias] = $column;
            } else {
                $parts[] = $select;
            }
        } else {
            $parts[] = $select;
        }

        $this->sqlParts['select'] = $parts;

        return $this;
    }
814004
protected function processSelect(\Zend_Db_Select $select)
    {
        // $select->joinLeft('gems__rounds',      'gto_id_round = gro_id_round', array());
        // $select->join('gems__tracks',          'gto_id_track = gtr_id_track', array());
        $select->join('gems__surveys',         'gto_id_survey = gsu_id_survey', array());
        $select->join('gems__groups',          'gsu_id_primary_group = ggp_id_group', array());
        $select->join('gems__respondents',     'gto_id_respondent = grs_id_user', array());
        $select->join('gems__respondent2org',  '(gto_id_organization = gr2o_id_organization AND gto_id_respondent = gr2o_id_user)', array());
        $select->join('gems__respondent2track','gto_id_respondent_track = gr2t_id_respondent_track', array());        
        $select->join('gems__reception_codes', 'gto_reception_code = grc_id_reception_code', array());
        $select->joinLeft('gems__respondent_relations', '(gto_id_relation = grr_id AND gto_id_respondent = grr_id_respondent)', array()); // Add relation
        $select->joinLeft('gems__track_fields',  '(gto_id_relationfield = gtf_id_field AND gtf_field_type = "relation")', array());       // Add relation fields     
    }
16313
protected function addPrefixedColumnsToSelect(Select $select, $joinAlias)
    {
        foreach ($this->classTableColumnMap as $columnName => $prefixedColumnName) {
            $select->addColumn($prefixedColumnName, Expr::column($joinAlias, $this->classTable->findColumn($columnName)));
        }
    }
18317
protected function visitSirelNodeSelectStatement(Node\SelectStatement $select)
    {
        return join(" ", array_filter(array(
            "SELECT",

            ($select->distinct ? "DISTINCT" : null),

            ($select->projections
                ? join(", ", $this->visitEach($select->projections))
                : '*'),

            // FROM
            $this->visit($select->source),

            // WHERE
            ($select->restrictions 
                ? "WHERE " . join(" AND ", $this->visitEach($select->restrictions))
                : null
            ),

            // ORDER BY
            ($select->orders
                ? "ORDER BY " . join(", ", $this->visitEach($select->orders))
                : null),

            // GROUP BY
            ($select->groups
                ? "GROUP BY " . join(', ', $this->visitEach($select->groups))
                : null),

            // LIMIT
            ($select->limit ? $this->visit($select->limit) : null),

            // OFFSET 
            ($select->offset ? $this->visit($select->offset) : null)
        ))) . ';';
    }
1062513
public function select(...$select): Query\Select
    {
        $query = new Query\Select();
        $query->select(...$select);
        return $query;
    }
311448
public function from($tableName, $alias = null)
    {
        $rel = $this->currentOrClone();
        
        if ($alias) {
            $rel->select->from([$alias => $tableName]);
        } else {
            $rel->select->from($tableName);
        }
        return $rel;
    }
698734
public function union(SelectQuery $select, $all = false)
    {
        $this->unions[] = "\nUNION" . ($all ? ' ALL' : '') . "\n" . $select;

        return $this;
    }
440165
public function selectMany(Select $select, ResultSet\ResultSetInterface $resultSet = null)
    {
        if ($this->usePaginator) {
            $this->usePaginator = false;
            $rows = $this->initPaginator($select, $resultSet);
        } else {
            $result = $this->select($select, $resultSet);
            $rows = array();
            foreach ($result as $row) {
                $rows[] = $row;
            }
        }
        return $rows;
    }
158996
public function setSelect($select)
    {
        if (is_int($select)) {
            $this->select = $select;
        } else {
            $msg = "Select must be an integer, '" . gettype($select) . "' given.";
        }
    }
174488
public function onAliasChange(array $nodeIdList) : void
    {
        $this->aliasManager->invalidateRelated($nodeIdList);
        $this->aliasCacheLookup->refresh();
    }
249564
protected function processSelect($select, $context)
    {
        if ($select instanceof Aggregate) {
            $column = $this->processColumnOrSubQuery($select->column, $context);
            if ($column === $select->column) {
                return $select;
            } else {
                return new Aggregate($select->function, $column);
            }
        }

        return $this->processColumnOrSubQuery($select, $context);
    }
702607
protected function getTableSelects($tableName,$tableAlias = null)
  {
    $key = $tableName . '.' . $tableAlias;
    
    if (!isset($this->tableSelects[$key])) 
    {
      $this->loadTable($tableName,$tableAlias);
    }
    return $this->tableSelects[$key];
  }
175214
public void setSelect(final String select) {
    if (null == select) {
      this.select = null;
    } else {
      if (Strings.contains(select.toLowerCase(), "select")) {
        this.select = select;
      } else {
        this.select = "select " + select;
      }
    }
  }
757957
protected function addLoadClausesToSelect(Select $select, string $tableAlias): string
    {
        $table = $select->getTableFromAlias($tableAlias);

        foreach ($this->getAllColumnsToLoad() as $column) {
            $select->addColumn($column, Expr::column($tableAlias, $table->getColumn($column)));
        }

        return $tableAlias;
    }
966703
public function select($sSelector, $sOptionSelector)
    {
        $oSelectorsHandler = $this->getMinkSession()->getSelectorsHandler();
        $oSelect = null;

        if (strpos($sSelector, '/') === false) {
            $page = $this->getMinkSession()->getPage();
            $sParsedSelector = $oSelectorsHandler->xpathLiteral($sSelector);
            $oSelect = $page->find('named', array('select', $sParsedSelector));
        }

        if (is_null($oSelect)) {
            $oSelect = $this->getElementLazy($sSelector);
        }

        if (strpos($sOptionSelector, 'index=') === 0) {
            $iIndex = str_replace('index=', '', $sOptionSelector);
            $sOptionSelector = $this->_getSelectOptionByIndex($oSelect, $iIndex);
        } else {
            $sOptionSelector = str_replace(array('label=', 'value='), '', $sOptionSelector);
        }

        if (is_null($oSelect)) {
            $this->fail("Select '$sSelector' was not found!");
        }

        $oOptions = $oSelect->findAll('named', array('option', $oSelectorsHandler->xpathLiteral($sOptionSelector)));

        $oOption = $this->_getExactMatch($oOptions, $sOptionSelector);

        if (is_null($oOption)) {
            $this->fail("Option '$sOptionSelector' was not found in '$sSelector' select ");
        }

        $this->getMinkSession()->getDriver()->selectOption(
            $oSelect->getXpath(), $oOption->getValue(), false
        );

        $this->fireEvent($sSelector, 'change');
    }