Can some one please let me know how to pass the "map" set of parameters from 
one select to the another select that is provided in the first ResultMap?
 
<resultMap id="DistributionResult" class="Distribution">
 <result property="totalProducts" column="TOTAL_PRODUCTS"/>
 <result property="totalAmt" column="TOTAL_AMT"/>
 <result property="merchant.id"  column="TERM_ID"/> 
 <result property="max" column="{merchantId = TERM_ID}" 
select="merchant.getMaxValue"/>
</resultMap>
 
<select id="getDistribution" parameterClass="map" 
resultMap="DistributionResult">
SELECT COUNT(*) as TOTAL_PRODUCTS
    , SUM(a.amount) as TOTAL_AMT
    , A.TERMID as TERM_ID
       FROM tbl a, tbl b
       WHERE a.termid = b.id  
       <iterate property="merchants" open=" and a.SATHCDHACCTKEY in (" close = 
")" conjunction=","> 
       #merchants[]# 
      </iterate>
AND a.dtathdate BETWEEN #startDate# AND #endDate# group by A.TERMID 
</select>
 
I want to use the same "map" from the above select statement
 
<select id="getMaxVALue" resultClass="string">
SELECT MAX(subTbl.cnt1) as MAX_VALUE from (SELECT COUNT(A.KEY ) as cnt1
FROM ath a, merchantterminal m WHERE A.SATHTERMID = M.LID and M.LID = 
#merchantId# 
 <iterate property="merchants" open=" and a.KEY in (" close = ")" 
conjunction=","> 
       #merchants[]# 
      </iterate>
AND a.dtathdate BETWEEN #startDate# AND #endDate# group by 
to_char(a.dtathdate,'YYYYMMDD') ) subTbl
</select>
 
Thanks
KV


      

Reply via email to