在 SQL Server 中,我曾经做过类似的事情来向选择添加额外的列:
select *,
case
when w1.start_date < w2.start_date then
to_date(w2.START_date, 'DD/MM/YYYY') - 1
else
to_date(w1.end_date, 'DD/MM/YYYY')
end as end_date_modified
from WEIGHTED_AVERAGE w1
然而,Oracle 中的以下情况会导致“ORA-00923 FROM 关键字未在预期位置找到”:
select *,
case
when w1.start_date < w2.start_date then
to_date(w2.START_date, 'DD/MM/YYYY') - 1
else
to_date(w1.end_date, 'DD/MM/YYYY')
end end_date_modified
from WEIGHTED_AVERAGE w1
我已经搜索遍了,但不知道如何在 Oracle 中实现这一点。
try this
select w1.*,
case
when w1.start_date < w2.start_date then
to_date(w2.START_date, 'DD/MM/YYYY') - 1
else
to_date(w1.end_date, 'DD/MM/YYYY')
end end_date_modified
from WEIGHTED_AVERAGE w1
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)