In SQL Server I used to do something like this to add extra columns to a 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
Yet the following in Oracle causes "ORA-00923 FROM keyword not found where expected":
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
I've searched all over but can't figure out how to achieve this in 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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With