Delete an entry from many-to-many relation

@tention Sorry for the delay.
Here’s how I did it

const items = await strapi.connections.default("t1_t2__t2_t1")
        .where("t2_id", "in", [array of id's])
        .andWhere("t1_id", "in", function(qb) {
          qb.select("id").from("t1")
            .whereIn("col-x", function(qb) {
              qb.select("id")
                .from("t3")
                .where("col-y", ID);
            });
        })
        .del();

t1, t2: are table names
col-x, col-y: column name in table t1 & t3 respectively
items: no of items deleted

You can use any conditions in there

1 Like