diff --git a/packages/nocodb/src/db/BaseModelSqlv2.ts b/packages/nocodb/src/db/BaseModelSqlv2.ts index b49c80f4be..18b997a538 100644 --- a/packages/nocodb/src/db/BaseModelSqlv2.ts +++ b/packages/nocodb/src/db/BaseModelSqlv2.ts @@ -1208,10 +1208,8 @@ class BaseModelSqlv2 { !this.isSqlite, ); - let children = await this.execAndParse(finalQb, childTable); - if (this.isMySQL) { - children = children[0]; - } + const children = await this.execAndParse(finalQb, childTable); + const proto = await ( await Model.getBaseModelSQL({ id: rtnId, @@ -4408,7 +4406,7 @@ class BaseModelSqlv2 { let data = this.isPg || this.isSnowflake ? (await this.dbDriver.raw(query))?.rows - : query.slice(0, 6) === 'select' && !this.isMssql + : /^(\(|)select/.test(query) && !this.isMssql ? await this.dbDriver.from( this.dbDriver.raw(query).wrap('(', ') __nc_alias'), )