我有一个像这样的普通查询
select
t1c1
from
t1
where
t1c2 <> (select max(t2c1) from t2)
and
t1c3 < (select max(t2c1) from t2)
and
t1c3 >= ((select max(t2c1) from t2) - 20)
但是我想优化它,所以我定义了这样的变量
set @mt2c1 = (select max(t2c1) from t2);
select
t1c1
from
t1
where
t1c2 <> @mt2c1
and
t1c3 < @mt2c1
and
t1c3 >= (@mt2c1 - 20)
定义此变量会使查询更快吗?