gpt4 book ai didi

sql - 添加要选择的列 *

转载 作者:行者123 更新时间:2023-12-04 19:36:18 25 4
gpt4 key购买 nike

在 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 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

我到处搜索,但无法弄清楚如何在 Oracle 中实现这一目标。

最佳答案

试试这个

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

关于sql - 添加要选择的列 *,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7993931/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com