In this simplified case, given an open SQL connection, you're correct. That would simplify this query, and I'm a little embarrassed not to have seen that (obexcuse: I've been spending too much time in Java-land lately). There is more to the function than I included in my question, so it does need to be a function and can't be straight SQL. Thanks, Ross On 10/2/07, Joshua D. Drake <jd@xxxxxxxxxxxxxxxxx> wrote: > Maybe I am missing something, but wouldn't ON DELETE CASCADE do what you > need? -- Ross Bagley "Security is mostly a superstition. It does not exist in nature... Life is either a daring adventure or nothing." -- Helen Keller ---------------------------(end of broadcast)--------------------------- TIP 2: Don't 'kill -9' the postmaster