我的数据包含2500行和2列
iner tert
41.6 7.19
43.1 7.06
44.5 4.02
45.6 3.81
45.9 7.85
46.2 5.02
47.1 6.12
52.6 5.12
61.1 8.19
68.2 10.14
72.1 12.41
79.8 6.19
81.1 7.18
说明
(max+min)/2+min as reip
申请公式
700+(reip-r45)/(r72-r45)*40
我想显示reip值和repw值作为输出
我在PostGreSQL中尝试过它
Select (MAX(tert)+MIN(tert))/2+MIN(tert) as reip from table_name where iner between 43 and 79
这是有效的,但我不知道在此公式的700+(reip-r45)/(r72-r40)*40
中应用此reip值以及如何将输出值显示为reip和repw
我试过这个查询它不起作用..
select reip, 700+(reip-r45)/(r72-r45)*40 as reipw
from (
select (MAX(tert)+MIN(tert))/2+MIN(tert) as reip, tert where iner=44.5 as r45, tert where iner=71.9 as r72
from table_name
where iner between 650 and 800
) as SE_23693370
请帮我单次执行完成这项任务.... ;
答案 0 :(得分:0)
你可以这样做:
select reip, reip+1 as example
from (
select (MAX(tert)+MIN(tert))/2+MIN(tert) as reip
from table_name
where iner between 43 and 79
) as SE_23693370
;
以下是一个工作示例:http://sqlfiddle.com/#!15/0ad8f/2