protected function compileSubQuery($subQuery, array &$bindings, bool $parenthesise = true): string
    {
        if ($subQuery instanceof Query) {
            try {
                $subQuery = $this->compile($subQuery);
            } catch (InvalidQueryException $exception) {
                throw new InvalidQueryException(
                    'Error in subquery: '.$exception->getMessage(),
                    $exception->getCode(),
                    $exception
                );
            }
        }

        $this->mergeBindings($bindings, $subQuery->getBindings());
        $sql = $subQuery->getSQL();

        return $parenthesise ? '('.$sql.')' : $sql;
    }