我想通过为嵌套查询分配“变量名”来重写以下查询。
select lastname
from table2
where firstname = (select name from table1 where val="whatever")
我希望查询看起来像这样:
( select name
from table1
where val = "whatever") as retrieved_name;
select lastname
from table2
where firstname = retrieved_name
纯SQL可以吗?