How can i do:
REMOVE FROM foo WHERE id = 1 And bar does not contain id == 1
To find out how to remove a row id = 1from a table foo, only if barthere is no row in the table in the table id = 1.
id = 1
foo
bar
DELETE FROM foo WHERE id=1 AND NOT EXISTS (SELECT * FROM bar WHERE id=1)
I assume that you mean that foo and bar are tables, and you want to delete the entry from foo if it does not exist in the bar.
using the connection:
delete f from foo f left join bar b on f.id = b.id where f.id = 1 and b.id is null
SQL "Exists".
http://www.techonthenet.com/sql/exists.php