在SQL Server中,我过去常常这样做,向select添加额外的列:
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中实现这一点。
发布于 2011-11-03 19:17:06
尝尝这个
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
发布于 2011-11-03 19:18:03
将选择的开头修改为W1。*
https://stackoverflow.com/questions/7993931
复制相似问题