you can use DENSE_RANK() function.Here i show some example that show results
and i hope clear concept about ranking functions
in SQL Server:
into Person1 (name,sal)values('Anil','100000')
into Person1 (name,sal)values('Patel','100000')
into Person1 (name,sal)values('Chikoti','300000')
into Person1 (name,sal)values('Nikol','100000')
into Person1 (name,sal)values('Rajeev','100000')
into Person1 (name,sal)values('Binod','300000')
into Person1 (name,sal)values('Pradeep','500000')
into Person1 (name,sal)values('Dinel','300000')
into Person1 (name,sal)values('Gemil','400000')
ROW_NUMBER():Returns
rownumber of each row of result set.
value_expression , ... [ n ] ] order_by_clause )
DENSE_RANK(): Returns the
rank of rows within the partition of a result set, without any gaps in the
ranking.
( [ <partition_by_clause> ] < order_by_clause >
)
RANK():
Returns the rank of each row within the partition of a
result set.
OVER ( [
partition_by_clause ] order_by_clause )
query
used for this purpose because it provide a number for same values.