以下の 2 つのクエリを結合する際に助けが必要です。私はオラクルが初めてです。ここで投稿を確認しましたが、言及されている結合は単純なクエリ用です。以下の 2 つのクエリの結果を並べて表示するのを手伝ってください。
(select Branch, count(*) as "No of Accounts Opened"
from (SELECT A.CUST_AC_NO,
A.CCY,
A.branch_code Branch,
A.ACY_CURR_BALANCE,
A.AC_OPEN_DATE,
B.CUSTOMER_NAME1,
C.LIMIT_AMOUNT,
D.ACCOUNT_CLASS,
D.DESCRIPTION
FROM STTM_CUST_ACCOUNT A,
STTM_CUSTOMER B,
getm_facility C,
STTM_ACCOUNT_CLASS D,
getm_liab_cust e
WHERE B.CUSTOMER_NO = A.CUST_NO
AND A.ACCOUNT_CLASS = D.ACCOUNT_CLASS
and c.liab_id = e.liab_id
and e.customer_no = b.customer_no
and e.customer_no = a.cust_no
AND B.LIABILITY_NO = e.customer_no
AND RTRIM(C.LINE_CoDe) || LTRIM(TO_CHAR(C.LINE_SERIAL)) =
RTRIM(A.LINE_ID)
AND A.RECORD_STAT = 'O'
and c.record_stat = 'O'
and e.record_stat = 'O'
--AND to_char(A.AC_OPEN_DATE,'YYYY')=:Year
--AND trim(to_char(A.AC_OPEN_DATE,'Month'))=:Month
--AND a.BRANCH_CODE ='001'
AND A.CCY <> 'ZWD'
UNION
SELECT A.CUST_AC_NO,
A.CCY,
Branch_code Branch,
A.ACY_CURR_BALANCE,
A.AC_OPEN_DATE,
B.CUSTOMER_NAME1,
NULL LIMIT_AMOUNT,
D.ACCOUNT_CLASS,
D.DESCRIPTION
FROM STTM_CUST_ACCOUNT A,
STTM_CUSTOMER B,
STTM_ACCOUNT_CLASS D
WHERE B.CUSTOMER_NO = A.CUST_NO
AND A.ACCOUNT_CLASS = D.ACCOUNT_CLASS
AND A.RECORD_STAT = 'O'
--AND to_char(A.AC_OPEN_DATE,'YYYY')=:Year
--AND trim(to_char(A.AC_OPEN_DATE,'Month'))=:Month
--AND BRANCH_CODE ='001'
AND A.CCY <> 'ZWD')
group by Branch
order by Branch) A
2番目のクエリは
(select Branch,count(*) as "No of Accounts Closed" from(SELECT
a.branch_code Branch,
A.CUST_AC_NO,
A.CCY,
A.ACY_CURR_BALANCE,
a.maker_id,
a.maker_dt_stamp,
a.checker_id,
A.CHECKER_DT_STAMP,
B.CUSTOMER_NAME1,
C.ACCOUNT_CLASS,
C.DESCRIPTION
FROM
STTMS_CUST_ACCOUNT A,
STTMS_CUSTOMER B,
STTMS_ACCOUNT_CLASS C
WHERE
B.CUSTOMER_NO = A.CUST_NO
AND A.ACCOUNT_CLASS = C.ACCOUNT_CLASS
AND A.RECORD_STAT = 'C'
---AND A.BRANCH_CODE ='001'- :brn
--AND trunc(to_char(A.CHECKER_DT_STAMP,'YYYY'))=:Year
--AND trim(to_char(A.CHECKER_DT_STAMP,'Month'))=:Month
ORDER BY
CUSTOMER_NAME1)group by Branch order by Branch) B