Reputation: 5
Description
Formula
700+(reip-r45)/(r72-r45)*40
output value as repw and i want to display reip value and repw value as output
I tried it in PostGreSQL
Select (MAX(tert)+MIN(tert))/2+MIN(tert) as reip from table_name where iner between 43 and 79
This is working but i dont know to apply this reip value in 700+(reip-r45)/(r72-r40)*40 in this formula and how to get the ouput value display as reip and repw
I tried this query it's not working..
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
How to execute the task as a single query? Anyone guide me...
Upvotes: 0
Views: 55
Reputation: 77936
Change your query a bit like below
select reip,
(700+(reip-r45))/((r72-r45)*40) as reipw
from (
select (MAX(tert)+MIN(tert))/2+MIN(tert) as reip,
case when iner=44.5 then tert end as r45,
case when iner=72.1 then tert end as r72
from table_name
where iner between 43 and 79
group by iner,tert
) as SE_23693370
Upvotes: 1