• If you want to restart with 1 for each new combination of VndNbr, InvNbr then you should change it to

    PARTITION BY VndNbr, InvNbr ORDER BY batNbr DESC



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]