public function resolveTable(string $name)
    {
        if (!empty($name) && is_string($name))
        {
            if (isset($this->aliases[$name]))
                return array($this->aliases[$name], $name);

            if (isset($this->tables[$name]))
            {
                if (count($this->tables[$name]) === 1)
                    return array($name, null);
                throw new QueryException("Multiple references to $name, use the appropriate alias");
            }

            if (!empty($this->parent_scope))
                return $this->parent_scope->resolveTable($name);

            throw new QueryException("Unknown source table $name");
        }

        throw new QueryException("No table identifier provided");
    }