我的数据就像这样
wavelength reflectance
341.6 2.48
343.6 2.58
344.7 2.37
346.3 2.32
347.9 2.29
349.5 2.36
351.1 2.23
352.6 2.24
354.2 2.25
355.8 2.29
357.4 2.28
358.9 2.23
我想使用公式
公式
r/i
执行
预期产出
tera
1.105655
2.82345
.......
答案 0 :(得分:1)
select (select sum(reflectance) from table where wavelength between 340 and 345)/
(select sum(reflectance) from table where wavelength between 350 and 355) as tera
答案 1 :(得分:0)
select
r/i as tera,
(r-i)/(r+i) as tera2
from
(select wavelength, reflectance as r, row_number() over(order by wavelength) as rn
from test where wavelength between 340 and 345) t1
join
(select wavelength, reflectance as i, row_number() over(order by wavelength) as rn
from test where wavelength between 350 and 355) t2 using (rn)
工作正常......