It might be possible to squirrel away the multitudinous lookups with a heap of left joins in a sub-query.

People who live and breathe SQL often don't know or forget about things like Don't Repeat Yourself. But then, SQL often makes that hard to do.

Wade.