[reporter="jvs", created="Fri, 8 Dec 2006 16:57:02 -0500 (GMT-05:00)"]
In this example, it should require two levels of parens between sum and select (one for the sum functional syntax, and one for the scalar subquery).
select sum(SELECT
CASE WHEN "VLE_OPTY_STATUS"."LE_DOMAIN_2" = 'LOST' THEN CASE WHEN "OPPORTUNITY"."ACT_OPTY_CLOSE_DK" > "OPPORTUNITY"."OPTY_START_DK" THEN "OPPORTUNITY"."ACT_OPTY_CLOSE_DK" - "OPPORTUNITY"."OPTY_START_DK" ELSE 0 END ELSE 0 END
FROM "system_SFDC_NTST_TEST"."VLE_OPTY_STATUS" AS "VLE_OPTY_STATUS"
WHERE "VLE_OPTY_STATUS"."STATUS_KEY" = "OPPORTUNITY"."OPTY_STATUS_KEY") as "m3"
from "OPPORTUNITY"
[reporter="jvs", created="Fri, 8 Dec 2006 16:57:02 -0500 (GMT-05:00)"] In this example, it should require two levels of parens between sum and select (one for the sum functional syntax, and one for the scalar subquery).
select sum(SELECT
CASE WHEN "VLE_OPTY_STATUS"."LE_DOMAIN_2" = 'LOST' THEN CASE WHEN "OPPORTUNITY"."ACT_OPTY_CLOSE_DK" > "OPPORTUNITY"."OPTY_START_DK" THEN "OPPORTUNITY"."ACT_OPTY_CLOSE_DK" - "OPPORTUNITY"."OPTY_START_DK" ELSE 0 END ELSE 0 END
FROM "system_SFDC_NTST_TEST"."VLE_OPTY_STATUS" AS "VLE_OPTY_STATUS"
WHERE "VLE_OPTY_STATUS"."STATUS_KEY" = "OPPORTUNITY"."OPTY_STATUS_KEY") as "m3"
from "OPPORTUNITY"