protected function doJoin($type, array $args)
    {
        if (count($args) === 0) {
            throw new QueryException('No arguments given');
        }

        $tableName = $args[0];
        $condition = '';

        if (count($args) == 2) {
            $condition = $args[1];
        } elseif (count($args) == 3) {
            $condition = $args[1] . ' = ' . $args[2];
        }

        $this->parts['from'][] = array(
            'table' => $tableName,
            'type' => $type,
            'condition' => $condition,
        );

        return $this;
    }