• One more "real-world" caveat: there could be a tie for the number 25 spot, so simply using "Top 25" in the select may leave a worthy salesperson off the list. One way to include all who belong would be to use the RANK() function. I like to wrap such in a CTE, but a correlated sub-query or other structure may be just as sound (or better) for your use.

    Declare @StartDt Datetime

    Declare @EndDt Datetime

    Set @StartDt = '20090101'

    Set @EndDt = '20090131'

    ;with

    Sales (SalesRank, SalesPerson, TotSalesDollars)

    as

    (Select SalesRank = Rank() over (order by sum(SalesDollars) Desc)

    ,SalesPerson

    ,sum(SalesDollars)

    from #SalesTbl

    Where SalesDate between @StartDt and @EndDt

    group by SalesPerson) --end of CTE

    selectSalesRank

    ,SalesPerson

    ,TotSalesDollars

    from Sales

    where SalesRank <= 25