system/classes/Db_MySQL.php
protected function calculateSELECT()
    {
        $this->query .= 'SELECT ';
        
        // If distinct
        if ($this->distinct) {
            $this->query .= ' DISTINCT ';
        }
                  
        // If SELECT
        $this->queryStringFromArray('selects', '', ', ');
        
        // Determine Table(s)
        $this->queryStringFromArray('tables', ' FROM ', ', ');
        
        // Join
        $this->joinStringFromArray('joins');
        
        // Where and IN
        $this->conditionStringFromArray('wheres', ' WHERE ', ' AND ');
        
        // GroupBy
        $this->queryStringFromArray('groupBys', ' GROUP BY ', ', ');
        
        // Having
        $this->conditionStringFromArray('havings', ' HAVING ', ' AND ');
        
        // OrderBy
        $this->queryStringFromArray('orderBys', ' ORDER BY ', ', ', false);
        
        // Limit
        if ($this->limit) {
            $this->query .= ' LIMIT '.$this->limit;
        }
        
        // Offset
        if ($this->offset) {
            $this->query .= ' OFFSET '.$this->offset;
        }
    }
protected function calculateSELECT()
    {
        $this->query .= 'SELECT ';
        
        // If distinct
        if ($this->distinct) {
            $this->query .= ' DISTINCT ';
        }
                  
        // If SELECT
        $this->queryStringFromArray('selects', '', ', ');
        
        // Determine Table(s)
        $this->queryStringFromArray('tables', ' FROM ', ', ');
        
        // Join
        $this->joinStringFromArray('joins');
        
        // Where and IN
        $this->conditionStringFromArray('wheres', ' WHERE ', ' AND ');
        
        // GroupBy
        $this->queryStringFromArray('groupBys', ' GROUP BY ', ', ');
        
        // Having
        $this->conditionStringFromArray('havings', ' HAVING ', ' AND ');
        
        // OrderBy
        $this->queryStringFromArray('orderBys', ' ORDER BY ', ', ', false);
        
        // Limit
        if ($this->limit) {
            $this->query .= ' LIMIT '.$this->limit;
        }
        
        // Offset
        if ($this->offset) {
            $this->query .= ' OFFSET '.$this->offset;
        }
    }
Create a SELECT statement