【发布时间】:2020-04-09 10:41:54
【问题描述】:
我想在 partition by 语句中的 order by 子句中使用多个 case 语句。 我有很多专栏,所以我只发布所需的一个。
我的餐桌顾客有:
Select
name,
ROW_NUMBER() OVER(PARTITON BY lastname, rollno
ORDER BY
CASE
WHEN
NVL(gender, address) IS NULL
then
a.effdate desc
else
CASE
WHEN
NVL(a.postoffc, a.mon) <= file.effdate
then
file.effdate
else
a.postoffc
END
desc, NVL(l4.covcode, a.pass)
end
)
rn
from
customers a;
如果,我删除了这些 case 语句,那么我与其他表的连接和查询工作正常。所以,连接语句或任何其他逻辑没有问题。我遇到的问题是当我使用多个 case 语句时。我认为我的语法是错误的。请告诉我如何解决这个错误。我需要这个case语句逻辑作为强制性的。
【问题讨论】: