I'm sure you're right, Ksharp. I saw a couple ambiguities in the original specs that I just chose to ignore. I couldn't decide if "each and every transaction" in criterion #2 meant "starting with the very 1st" or "starting with the 1st that meets criterion #1". And, if the latter, does that that mean that a branch with, say, 19 transactions that fail criterion #1 followed by 1 transaction that meets it, should be output, but a branch with 19 that do followed by 1 that doesn't gets flushed. That didn't make sense to me, so I just used opendate to get the discussion started. I also wondered if the target date of 201104 was a constant or was intended to be a stand-in for max(trandate). And, if the latter, is that by branch or for the table as a whole. So again, I just took the easy way out. If, in fact, there are any transactions after that date, my algorithm fails (as, I think, does yours.) Anyway, if the OP wanted to clarify the specs, this has been a good discussion, I think. And hey, my SQL solution was kind of elegant, no? Wrong, but elegant. Karl
... View more