显示:
所有'ACTIVE'(大写)FD账户都是在2004年之后开始的。
这是我到目前为止所写的内容
SELECT ACCOUNT_NO, CUST_ID, ROUND(INITIAL_AMT,2) AS INITIALAMTIN_LAKHS,
CASE
WHEN INITIALAMTIN_LAKHS<50000 THEN 'low'
WHEN INITIALAMTIN_LAKHS>5000000 THEN 'High'
ELSE 'Medium'
END 'AMOUNT_CATEGORY',
START_DT, FROM BANK_FD_ACCOUNT;
无法进一步了解
表i:
BANK_FD_ACCOUNT
(
ACCOUNT_NO,
CUST_ID,
START_DT,
FD_TERM_MNTH,
INITIAL_AMT,
ACC_STATUS
)
答案 0 :(得分:1)
希望INITIAL_AMT
实际上是金额,而不是数十万或数百万或类似的东西,那么你需要将其改为数十万:
SELECT
ACCOUNT_NO,
CUST_ID,
ROUND(0.00001 * INITIAL_AMT,2) AS INITIALAMTIN_LAKHS,
case
when INITIAL_AMT<50000 then 'Low'
when INITIAL_AMT>5000000 then 'High'
else 'Medium'
end as AMOUNT_CATEGORY,
START_DT
from
BANK_FD_ACCOUNT
where
ACC_STATUS = 'ACTIVE' and
START_DT >= '20150101'
不知道什么是成熟日期或如何在几个月内使用术语来计算它。
答案 1 :(得分:0)
有效查询的一个例子......
SELECT ACCOUNT_NO
, CUST_ID
, ROUND(INITIAL_AMT,2) INITIALAMTIN_LAKHS
, CASE WHEN ROUND(INITIAL_AMT,2) < 50000 THEN 'low'
WHEN ROUND(INITIAL_AMT,2) > 5000000 THEN 'High'
ELSE 'Medium'
END AMOUNT_CATEGORY
, START_DT
FROM BANK_FD_ACCOUNT;
答案 2 :(得分:0)
SELECT account_no,
cust_id,
ROUND(initial_amt/100000,2) AS initialamtin_lakhs,
CASE
WHEN initial_amt < 50000 THEN 'Low'
WHEN initial_amt > 500000 THEN 'High'
ELSE 'Medium'
END as amount_category,
start_dt,
ADD_MONTHS(start_dt, fd_term_mnth) AS maturity_date
FROM bank_fd_account
WHERE UPPER(acc_status) = 'ACTIVE' AND TO_CHAR(start_dt,'YYYY') > 2004
答案 3 :(得分:0)
alter session SET NLS_DATE_FORMAT='DD-Mon-YYYY HH24:MI:SS';
select ACCOUNT_NO,CUST_ID,
CASE
WHEN ROUND(INITIAL_AMT*0.00001,2)>FLOOR(ROUND(INITIAL_AMT*0.00001,2)) THEN
TO_CHAR (ROUND(INITIAL_AMT*0.00001,2),'0.99')
ELSE TO_CHAR(ROUND(INITIAL_AMT*0.00001,2))
END as INITIALAMTIN_LAKHS,
CASE
WHEN INITIAL_AMT<50000 THEN 'Low'
WHEN INITIAL_AMT>500000 THEN 'High'
ELSE 'Medium'
END as AMOUNT_CATEGORY,
START_DT,
ADD_MONTHS(START_DT,FD_TERM_MNTH) as MATURITY_DATE
from BANK_FD_ACCOUNT
where UPPER(ACC_STATUS)='ACTIVE' and TO_NUMBER(TO_CHAR(START_DT,'yyyy'))>2004;
答案 4 :(得分:0)
Select account_no,
cust_id,
CASE
WHEN ROUND(INITIAL_AMT*0.00001,2)<1 THEN
TO_CHAR (ROUND(INITIAL_AMT*0.00001,2),'0.99')
ELSE TO_CHAR(ROUND(INITIAL_AMT*0.00001,2))
END "INITIALAMTIN_LAKHS",
case
when initial_amt < 50000 then 'Low'
when initial_amt > 5000000 then 'High'
else 'Medium'
end "AMOUNT_CATEGORY",
To_char(start_dt, 'dd-Mon-YYYY HH24:MI:SS'),
To_char(add_months(start_dt,fd_term_mnth),'dd-Mon-YYYY HH24:MI:SS') as MATURITY_DATE
from bank_fd_account
where acc_status='Active'
and To_char(start_dt,'YYYY')>'2004';