>Hi Mike,
>
>Thank you for sharing all this with us.
>
>... but when I see an SQL like that I think that time has come to revert to more traditional procedural coding that at least allows proper documentation.
>
>Or is it just me?
>
>Marc
>
Undoubtedly, a great job was done, but generally I agree with you. In cases like this (and I've done lots of interest calculus, specially since inflation forced us to use conform rates instead of proportional), I'd rather see three or four subqueries creating cursors for themselves first, which can be properly documented and hopefully obvious, and then do a somewhat easier join.
Interest data was never too easy. You always need something which is not an event (i.e. a document with a record in some table), but have to create a new record on the date distance between that and something else, which is hard to catch at times. Well, c'est la guerre :)