当CASE语句为true时,SQL返回另一个表的值

当CASE语句为true时,SQL返回另一个表的值,第1张

当CASE语句为true时,SQL返回另一个表的值

您只能使用一组

WHEN
/
THEN
语句和
EXISTS

SELECt (CASE WHEN LEFt("_PROJECT_NUMBER",2) = 'C0'  THEN '('||"_PROJECT_NUMBER"||') '||"_PROJECT_DEscriptION"  WHEN LEFt("_PROJECT_NUMBER",2) = 'L0' AND       EXISTS (SELECT "Rollup_Project" FROM "Project_Rollup_Mapping" WHERe "PA_ACCOUNTED_TEST"."_PARENT_PROJECT_NUMBER" = "Project_Rollup_Mapping"."Project")       THEN (SELECt "Rollup_Project" FROM "Project_Rollup_Mapping" WHERe "PA_ACCOUNTED_TEST"."_PARENT_PROJECT_NUMBER" = "Project_Rollup_Mapping"."Project")  ELSE "_PARENT_PROJECT_NUMBER"       END) AS Rollup_Project2FROM "PA_ACCOUNTED_TEST";


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5618228.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-15
下一篇 2022-12-15

发表评论

登录后才能评论

评论列表(0条)

保存