diff --git a/packages/nocodb/src/db/BaseModelSqlv2.ts b/packages/nocodb/src/db/BaseModelSqlv2.ts index f362a6b779..cae38e99ef 100644 --- a/packages/nocodb/src/db/BaseModelSqlv2.ts +++ b/packages/nocodb/src/db/BaseModelSqlv2.ts @@ -3773,15 +3773,18 @@ class BaseModelSqlv2 { await this.dbDriver(vTn) .where({ - [vParentCol.column_name]: this.dbDriver(parentTn) - .select(parentColumn.column_name) - .whereIn(parentTable.primaryKey.column_name, childIds) - .first(), [vChildCol.column_name]: this.dbDriver(childTn) .select(childColumn.column_name) .where(_wherePk(childTable.primaryKeys, rowId)) .first(), }) + .whereIn( + [vParentCol.column_name], + this.dbDriver(parentTn) + .select(parentColumn.column_name) + .whereIn(parentTable.primaryKey.column_name, childIds) + .first(), + ) .delete(); } break;