• Two comments:

    First, thanks I did not understand the SQL-92 usage of the addtional FROM clause which allows the join. I knew there had to be an easier way to do this, but after posting and search the newsgroups I could not resolve my syntax issues. I obviously missed the additional form clause. The statement should have been:

    DELETE

    FROM Orders

    FROM Orders O

    LEFT OUTER JOIN OrderLines OL

    ON O.OrdNo = OL.OrdNo

    WHERE o.OrdDate < '2003-03-01'

    In my attempt to share my solution, I got to learn. This is what makes this site so great!

    Second, with regard to the RI, needing to delete data is not a justification for reengineering an architecture. In fact, the system in question is a large legacy system which is not a candidate for any rearchitechture. The example was used on an IBM AS400 not a SQL Server. An RPG programmer was looking for help in performing the deletes. He came to me with code he couldn't get to work because he had failed to include the test for O.OrdNo = OL.OrdNo in his where clause of his subselect. He ended up deleting the entire table. Fortunately that was on a test system, but I figured the question was generic enough to warrant writing about and passing it along.

    Perhaps, I should have noted the circumstances in the article.