ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paulo Ferreira de Moura Junior <paulo.lis...@paulomourajr.net>
Subject Re: using #value[]#
Date Thu, 09 Jun 2005 20:33:36 GMT
On 6/9/05, Paul Barry <pauljbarry3@gmail.com> wrote:
 > The query I would like to end up with is:
 >
 > SELECT
 >   session_id, count(*) count
 > FROM
 >   events
 > WHERE
 >   session_id IN (1,2,3)
 > GROUP BY
 >   session_id

    Try this :

<select id="findCountsBySession" parameterClass="list" resultMap="counts">
SELECT
   session_id as id, count(*) count
FROM
   events
<dynamic prepend="WHERE">
   <iterate property="value" open="session_id IN (" close=")"
            conjunction=",">
         #value[]#
   </iterate>
</dynamic>
GROUP BY
   session_id
</select>

    Regards.



Mime
View raw message