Multi-column LAG code is verbose

Thanks, hadn't thought of that one.

That has the same Logical Rows and Scans as my test, so performance looks good (bit of a small sample size! I'll try something bigger in a moment).

There's a lot less going on (in terms of Stream Aggregate to get LAST_VALUE, and a Window Spool(ROWS BETWEEN), and some Compute Scalar(DEFINE: for TopRowNumberNNNN and BottomRowNumberNNNN, and whilst they may be pretty trivial they aren't "nothing" :slight_smile: