我有一个查询,它给了我所有的记录。现在我想检查所有记录中有多少记录位于这三个条件之间
- 小于等于 250,000
- 250,000 500,000 之间
- 50万及以上
我总共有 6 列。通过减去Credit Dist dt - App Received dt
我得到的列working days1
,通过减去LO Issued - appr_dec
我得到的working days2
。在确定了哪些记录属于哪个条件之后,我必须计算每个条件下的所有应用程序,并将应用程序的计数除以working day1
和working day2
。我如何确定哪个应用程序属于哪个条件并继续进行?
查询很长,所以我尝试放置一个虚拟查询来给出一个想法。
select LOSA_APP.app_ref_no AS "App.Ref.No.",
LOSA_EXP_SUMM_Z.group_exp AS "Group Exposure Amount",
column AS "App Received dt",
column AS "Credit Dist dt",
column AS "appr_dec",
column AS "LO Issued"
from
losa_app LOSA_APP
INNER JOIN
code_branch CODE_BRANCH
ON
LOSA_APP.attend_branch = CODE_BRANCH.branch_id
.... -- more joins
where
LOSA_APP.app_status in ('A','R')
and
..... --other conditions
对于条件,我必须检查LOSA_EXP_SUMM_Z.group_exp
类似LOSA_EXP_SUMM_Z.group_exp <= 250,000
, LOSA_EXP_SUMM_Z.group_exp between 250,000 and 500,000
,LOSA_EXP_SUMM_Z.group_exp >= 500,000
谢谢