Delete records where count of a related records in another table matches a condition

I have two tables with the following schema: table1 ( id UUID UNIQUE NOT NULL PRIMARY KEY, … ); table2 ( id UUID UNIQUE NOT NULL PRIMARY KEY, table1_id UUID NOT NULL FOREIGN KEY REFERENCES table1(id), … ); I would like to delete all records in table 1 where the count of related records in… Read More Delete records where count of a related records in another table matches a condition