Hi,
I'm trying to use use a sum value from table2 in my nested select, but I can't seem to figure a way to not have to calculate it twice.
Is there some way to do this efficiently?
I'm trying to use use a sum value from table2 in my nested select, but I can't seem to figure a way to not have to calculate it twice.
Code:
select a, b, c, d, e,
( select
name
from
table1
where
minv <= (select sum(num) from table2 where a != b)
and
maxv >= (select sum(num) from table2 where a != b) )
from
table2, table3, table4
where
............... a = b .........
Comment