我正在使用 oracle fusion,我正在使用的应用程序之一(值集)不允许我在 select 语句中使用函数,并且 from 部分有 200 个字符的限制。
这个查询给了我我想要的,但我不能用选择的总和 -
SELECT SUM(d.ABS_UNITS) from PER_ALL_PEOPLE_F b, ANC_ABSENCE_PLANS_F_TL c,
ANC_PER_ABS_PLAN_ENTRIES d
WHERE
d.PERSON_ID = b.PERSON_ID
AND c.ABSENCE_PLAN_ID = d.ABSENCE_PLAN_ID
AND c.name = 'FMLA LWOP'
and d.start_date between '2017-04-02' and '2017-04-15'
AND b.PERSON_NUMBER = p_num
我也试过这个,但有字符限制问题 -
Select aa.bb from
(SELECT SUM(d.ABS_UNITS) as bb from PER_ALL_PEOPLE_F b,
ANC_ABSENCE_PLANS_F_TL c, ANC_PER_ABS_PLAN_ENTRIES d
WHERE
d.PERSON_ID = b.PERSON_ID
AND c.ABSENCE_PLAN_ID = d.ABSENCE_PLAN_ID
AND c.name = 'FMLA LWOP'
and d.start_date between '2017-04-02' and '2017-04-15'
AND b.PERSON_NUMBER = p_num
) aa
这种方法是我一直在尝试将总和放在 where 子句中的方法,但它没有返回任何内容。
Select
d.ABS_UNITS
FROM
PER_ALL_PEOPLE_F b, ANC_ABSENCE_PLANS_F_TL c, ANC_PER_ABS_PLAN_ENTRIES d
WHERE
d.PERSON_ID = b.PERSON_ID
AND c.ABSENCE_PLAN_ID = d.ABSENCE_PLAN_ID
AND c.name = 'FMLA LWOP'
AND b.PERSON_NUMBER = pnum
and d.start_date between '2017-04-02' and '2017-04-15'
AND d.ABS_UNITS = (SELECT SUM(d.ABS_UNITS) from PER_ALL_PEOPLE_F b,
ANC_ABSENCE_PLANS_F_TL c, ANC_PER_ABS_PLAN_ENTRIES d
WHERE
d.PERSON_ID = b.PERSON_ID
AND c.ABSENCE_PLAN_ID = d.ABSENCE_PLAN_ID
AND c.name = 'FMLA LWOP'
and d.start_date between '2017-04-02' and '2017-04-15'
AND b.PERSON_NUMBER = pnum
)
任何意见和建议将不胜感激。