I was reading on RANKING function for ms sql. I understand the others function except NTILE(). Lets say if i have this data:
StudentID MARKS
It will arrange the data in descending order of marks and then split it into 2 groups.
If the data cannot be split into equal groups, then the first few groups will have more rows than the latter groups.
So NTILE(2) will give you
StudentID MARKS NTILE
S5 93 1
S3 91 1
S2 83 1
S4 83 2
S1 75 2
Similarly NTILE(3) will give you
StudentID MARKS NTILE
S5 93 1
S3 91 1
S2 83 2
S4 83 2
S1 75 3