DELETE Authors FROM Authors INNER JOIN Books_Authors ON Authors.kod=Books_Authors.Author_Kod INNER JOIN Books ON Books_Authors.Book_Kod=Books.kod WHERE Books.Count = 0 There is a code that deletes all authors, the number of books in which is equal to 0. How to alter the code to delete with the help of the mssql trigger?
Here are my attempts:
alter trigger deleteBooks ON Authors FOR DELETE AS DELETE Authors from Authors INNER JOIN Books_Authors ON Authors.kod=Books_Authors.Author_Kod INNER JOIN Books on Books_Authors.Book_Kod=Books.kod WHERE Books.Count = 0 GO