SELECT "OrdDet"."DetID",
"OrdDet"."ServQty",
"OItem"."PlanID",
CASE "OrdDet"."resourceID"
WHEN 100522 THEN 1024
WHEN 100488 THEN 50
END "ResourceAmount"
FROM "OrdDet"
JOIN "Subscription" USING ("subscrip
JOIN "PlanRate" USING ("PlanID")
AND "Subscription"."PlanID" = "Plan
WHERE "OrdDet"."resourceID" IN (10048
AND "Subscription"."PlanID" <= 265
AND "Subscription"."PlanID" >= 260
AND "PlanRate"."resourceID" = 10001
AND "OItem"."Status" = 40
AND "OIType" IN (60, 80)
AND "SubscrParam"."IncludedValue" != "PlanRate"."includedValue"
+ ("OrdDet"."ServQty" * "OrdDet"."resourceID")
ORDER BY "OrdDet"."subscriptionID"
&#34;&#34;&#34;)
我需要能够拥有&#34; OrdDet&#34;。&#34; resourceID&#34;当我在这行代码上进行计算时,为1024或50
AND "SubscrParam"."IncludedValue" != "PlanRate"."includedValue"
+ ("OrdDet"."ServQty" * "OrdDet"."resourceID")
目前只使用100522或100488.此外,当我使用&#34; ResourceAmount&#34;而不是&#34; OrdDet&#34;。&#34; resourceID&#34;它无法识别&#34; ResourceAmount&#34;无论如何我可以在我的计算中包含更改值1024或50的情况吗?
答案 0 :(得分:0)
在重读这个问题几次之后,也许我现在明白了
更改
AND "SubscrParam"."IncludedValue" != "PlanRate"."includedValue"
+ ("OrdDet"."ServQty" * "OrdDet"."resourceID")
到
AND "SubscrParam"."IncludedValue" != "PlanRate"."includedValue"
+ ("OrdDet"."ServQty" * CASE "OrdDet"."resourceID"
WHEN 100522 THEN 1024
WHEN 100488 THEN 50
END)