mariadb delete from table where id not in another table code example
Example 1: mysql delete if not in another table
DELETE FROM BLOB
WHERE NOT EXISTS(SELECT NULL
FROM FILES f
WHERE f.id = fileid)
Example 2: mysql delete if not in another table
DELETE FROM BLOB
WHERE fileid NOT IN (SELECT f.id
FROM FILES f)