• Lynn Pettis (1/15/2013)


    10e5x (1/15/2013)


    Lynn, i am still trying. Mind explaining the difference between dense_rank() and row_number() if both using partion by?

    First thing you need to do is to read about the ROW_NUMBER(), RANK(), DENSE_RANK() functions in Books Online. Work through the samples they provide, then move on to some of your own data.

    Once you have a good understanding of these functions and what they are doing, we can work on understanding the slightly more complex aspects of them and how I used them.

    Also, you should take the time to read this article, http://www.sqlservercentral.com/articles/T-SQL/71550/, as it discusses the main concepts behind how my code works as well.

    Hi lynn,

    I have finish reading the article by Jeff, and a few more on dense rank(), rank() and row number() and uds that the main diff of dense rank is that is will return the same ranking if there are duplicate value based on the order by. I have uds how ur solution work but there is this part that i do not get it. The way u derive GRPDATE. at this part:

    order by dateadd(dd,datediff(dd,0,EnterDt),0)) * -1

    maybe its becuz there are too many combination of dateadd plus datediff that confused me, but i do not uds the use of * -1

    If you dont mind, kindly clear my doubts when free, though i am dying to know. Thanks