diff --git a/lib/classes/record/adapter.php b/lib/classes/record/adapter.php index 008c2de452..f208368c9d 100644 --- a/lib/classes/record/adapter.php +++ b/lib/classes/record/adapter.php @@ -1564,7 +1564,7 @@ class record_adapter implements RecordInterface, cache_cacheableInterface $stmt->execute([':record_id' => $this->getRecordId()]); $stmt->closeCursor(); - $sql = "DELETE FROM permalinks WHERE subdef_id IN (SELECT subdef_id FROM subdef WHERE record_id=:record_id)"; + $sql = "DELETE permalinks FROM subdef INNER JOIN permalinks USING(subdef_id) WHERE record_id=:record_id"; $stmt = $connection->prepare($sql); $stmt->execute([':record_id' => $this->getRecordId()]); $stmt->closeCursor();