Cascading Deletes In Sql

If you wish to manually perform cascading deletes, an ingenious way to do this is to use a "not exists" keyword

DELETE FROM schema.a s WHERE a < 5
DELETE FROM schema.btsl WHERE not exists ( select * from schema.a ts where tsl.ID = ts.ID and tsl.VERSION = ts.VERSION);
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License