sql delete if id not existe in auther tavvle code example
Example 1: mysql delete if not in another table
DELETE b FROM BLOB b
LEFT JOIN FILES f ON f.id = b.fileid
WHERE f.id IS NULL
Example 2: mysql delete if not in another table
DELETE FROM BLOB
WHERE fileid NOT IN (SELECT f.id
FROM FILES f)