您可以为 from 子句分配别名吗?喜欢:
select a - b "Markup" from retail a, cost b;
编辑:对不起,我输入得太快了,并试图将问题简化到没有任何意义的地步
我实际上想要做的是使用别名来比较同一张表中两个发布日期之间的月份。这是我发现的作品:
select distinct to_char(months_between((select distinct pubdate
from books3
where pubid = 2),
(select distinct pubdate
from books3
where pubid = 4)), '99.99') "Answer"
from books3
我希望它看起来像这样:
select distinct months_between(a,b)
from (select distinct pubdate
from books3
where pubid = 2 as a),
(select distinct pubdate
from books3
where pubid = 4 as b)
但这不起作用