Problem:- Most of the time we require data in which we require first value and last value from different group of rows. Now how easy we can get result this is one of the challenge for us. Solution:- Lets understand this by an example. Suppose you have a sales table in which you maintain …
In last post we have discussed Row_Number() function. In similar way we have RANK function. By the name it is clear that we provide some kind of ranking for rows. It syntax is exact same like ROW_NUMBER(). Now the question comes in mind if it is same then why SQL SERVER introduce new function. …
Sometimes we require sequence column or we can a row number column so we have ROW_NUMBER() function in SQL SERVER. Lets understand this by following example In this example we have person table which have firstname, last name, middlename columns. Now we want to fetch records with a extra column ROW_Number() so we write …