The document contains a SQL query that joins three tables and filters on specific product codes, caste codes, account statuses and dates to count the number of branch codes grouped by branch code and product code.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
16 views1 page
Act
The document contains a SQL query that joins three tables and filters on specific product codes, caste codes, account statuses and dates to count the number of branch codes grouped by branch code and product code.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1
SELECT a.LBrCode , '' , b.PrdCd , 0 ,0 , count(a.
LBrCode ) FROM D009022 a
INNER JOIN D009021 b ON a.LBrCode = b.LBrCode AND substring(a.PrdAcctId , 1,8) = b.PrdCd AND b.ModuleType IN (13,14,30,31) INNER JOIN D009012 c ON a.CustNo = c.CustNo AND c.CasteCode IN ('SC','ST') WHERE b.PrdCd IN ('CCKMN','CCKON','CCKMNI','CCKONI','CCSHG') AND (a.AcctStat <> 3 OR a.DateClosed > ='30jun2020' ) AND a.AcctStat NOT IN (99) GROUP BY a.LBrCode , b.PrdCd