public function getJoinString()
    {
        $statement = "";
        
        foreach ($this->join as $i => $join) {
            $statement .= " " . $join['type'] . " " . $join['table'];
            
            if ($join['alias']) {
                $statement .= " AS " . $join['alias'];
            }
            
            // Add ON criteria if specified.
            if ($join['criteria']) {
                $statement .= " ON ";
                
                foreach ($join['criteria'] as $x => $criterion) {
                    // Logically join each criterion with AND.
                    if ($x != 0) {
                        $statement .= " " . self::LOGICAL_AND . " ";
                    }
                    
                    // If the criterion does not include an equals sign, assume a
                    // column name and join against the same column from the previous
                    // table.
                    if (strpos($criterion, '=') === false) {
                        $statement .= $this->getJoinCriteriaUsingPreviousTable($i, $join['table'], $criterion);
                    } else {
                        $statement .= $criterion;
                    }
                }
            }
        }
        
        $statement = trim($statement);
        
        return $statement;
    }