SQLite Forum

Get column rank from values in selected row
Login
I have table with age values in column 1
and weight values in the remaining columns indicating the weight centiles for a given age, simplified:

age,c10,c25,c50,c75,c90
-----------------------
1,5,6,7,8,9

2,6,7,8,9,10

3,7,8,9,10,11

So, for example age 3, weight 9 then
that would give c50 (50th centile, that is average weight for that age).

How would I do that in SQL, so giving me
c50 for values age 3 and weight 9?

RBS