Hi All,
I have this sql below that i use to compare values of z. I put z in a subquery and then compare it.
My qn is in in my else statement below, i want to put in another formula to calculate something else of which the info is only available in another table called var1(for example, n). i would like to put in sum(n)/count(n) to end as cv in my else statement. and then make a case statement if the cv > 10 then too large, if < 10 too little.
am i supposed to do another subquery in this subquery? any advise pls. thanks!
select
z,
CASE
when z > 1 then 'Pls increase your inputs'
when z < -1 then 'Pls decrease your inputs'
else 'No comment' END as Input
from
(select
case
when S < 0 then (S/En-Eg))
else (S/En+Eg))
end as z
from var2);