You can use subqueries in conditional statements. You can rewrite the preceding subquery that removes all records of sales of business books, as shown in the next example, to check for the records before deleting them:
if exists (select title_id from titles where type = "business") begin delete salesdetail where title_id in (select title_id from titles where type = "business") end
Copyright © 2005. Sybase Inc. All rights reserved. |