The Strange First Value

  • Comments posted to this topic are about the item The Strange First Value

  • I'd prefer to use
    FIRST_VALUE(pts) OVER (Partition by Team ORDER BY Year ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW)
    since this performs better (does not spill to tempdb as it does with the default RANGE BETWEEN...).

    God is real, unless declared integer.

  • t.franz - Thursday, July 27, 2017 1:58 AM

    I'd prefer to use
    FIRST_VALUE(pts) OVER (Partition by Team ORDER BY Year ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW)
    since this performs better (does not spill to tempdb as it does with the default RANGE BETWEEN...).

    Agreed
    Nice question, though, thanks Steve

    ____________________________________________
    Space, the final frontier? not any more...
    All limits henceforth are self-imposed.
    “libera tute vulgaris ex”

  • Nice simple question.
    But the  "wrong" output without the partition has a missing row - that query would return 11 rows, not 10, just as for tge output when teh qquery is corrected.

    Tom

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply