I am using the following query to get members (DMA_CODE) using certain conditions i.e. where clause
===QUERY 1 ========
Select * from DB2ADMIN.T_ANL_AMT a, DB2ADMIN.T_TIRE_MST b
where anl_prg_id='HR' and length(a.anl_dma_code) > 8 and
a.ANL_TRN_TYPE = 'D' AND a.ANL_YEAR = 2004 AND
a.ANL_MONTH = 10 AND a.ANL_DMA_CODE not in
( select CUS_DMA_CODE from t_cus_nap) AND
a.ANL_AMT between b.TIR_YR0_LO_AMT AND TIR_YR0_HI_AMT AND
b.TIR_YR0_ACTV_FL = 'Y' AND b.TIR_TIRE_ID != 'NO TIER' AND b.tir_prg_id ='HR'
=============
Now I also need to see the members (DMA_CODE) which I get by
executing the above query also has transactions for more than 5 months. There is a table which has all transaction of DMA_CODE, wherein I have to get the distinct count of dma_code which I get by executing the above dma_code.
====QUERY 2 ===
Select ctr_dma_code,count(distinct(ctr_adj_mm))
from DB2ADMIN.T_CLB_TRN
=========
1) is it possible to combine query 2 to query 1 to check the resultant member also exist in transaction table for more than 5 months. If yes, how can I write the query.
This is being done in a program (using Java).
Thnks
RAJ
===QUERY 1 ========
Select * from DB2ADMIN.T_ANL_AMT a, DB2ADMIN.T_TIRE_MST b
where anl_prg_id='HR' and length(a.anl_dma_code) > 8 and
a.ANL_TRN_TYPE = 'D' AND a.ANL_YEAR = 2004 AND
a.ANL_MONTH = 10 AND a.ANL_DMA_CODE not in
( select CUS_DMA_CODE from t_cus_nap) AND
a.ANL_AMT between b.TIR_YR0_LO_AMT AND TIR_YR0_HI_AMT AND
b.TIR_YR0_ACTV_FL = 'Y' AND b.TIR_TIRE_ID != 'NO TIER' AND b.tir_prg_id ='HR'
=============
Now I also need to see the members (DMA_CODE) which I get by
executing the above query also has transactions for more than 5 months. There is a table which has all transaction of DMA_CODE, wherein I have to get the distinct count of dma_code which I get by executing the above dma_code.
====QUERY 2 ===
Select ctr_dma_code,count(distinct(ctr_adj_mm))
from DB2ADMIN.T_CLB_TRN
=========
1) is it possible to combine query 2 to query 1 to check the resultant member also exist in transaction table for more than 5 months. If yes, how can I write the query.
This is being done in a program (using Java).
Thnks
RAJ