• While a decent question about an analytic function in SQL Server, I am not enthused by the terminology used in reference to the table variable.

    Table variables are not "memory tables." Table variables just like temp tables can be memory resident or can be disk resident. It is best to not call table variables a memory table to avoid perpetuating the myth that they are wholly memory resident.

    Here is a good proof on that for reference.

    http://sqlinthewild.co.za/index.php/2010/10/12/a-trio-of-table-variables/

    I am also not terribly enthused by the framing of the question. The question as currently posed, requests to return only the id. No answer has just the id. Instead all return author and id.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events