I have table column filled with float values e.g.:
   id-Values
   1- 0.19230769230769232
   2- 8.4848484848484854E
   3- 0.10823529411764705
   4- 0.05459770114942529
...
I would like to know: is there a SQL function that allows me to return a percentage of the selected row position compared to the others?
For example:
I want to know if there is an easy way to check if the row 4 is in the TOP 10%. Or if the row 2 is in the LAST 10% (order by values).
I know it's not possible to do a SELECT TOP 10% or a SELECT LAST 10% with SQL Server but it's just to give an example of what I want to do.
@Solution:
declare @a int
declare @b int
declare @values float
select @values = values from test where id <= 2
select @a = count(*) from test where values <= @values
select @b = count(*) from test 
select cast( cast(@a as float) / cast(@b as float) as float) * 100 as percentage