Forgot about that bit.  Thanks.

Based on that, I've come up with this:

<resultMap id="get-channel-count" class="channelCount">
      <result property="existing" column="existingCount" />
      <result property="pending" column="channel"
select="getChannelPendingCount" />
   </resultMap>

   <select id="getChannelPendingCount" resultClass="java.lang.Integer">
      SELECT COUNT(*) as pendingCount FROM scrimbot_pending_channels WHERE
channel=#value#
   </select>

   <statement id="getChannelCount" resultMap="get-channel-count">
      SELECT COUNT(*) as existingCount, channel FROM scrimbot_channels WHERE
channel=#value# GROUP BY channel
   </statement>

I'm trying to get whether or not the channel exist in either the existing or
pending tables.  I can see that the getChannelCount statement is called, but
the nested select is not happening, and I get a null object back.  Any
ideas?

Mike

-----Original Message-----
From: Ted Schrader [mailto:[EMAIL PROTECTED] 
Sent: January 27, 2006 3:10 PM
To: [email protected]
Subject: Re: Select count(*) in a resultMap

Hi Michael,

Try giving the resulting column an alias:

SELECT COUNT(*) AS MY_TOTAL FROM TABLE.

Then, use "MY_TOTAL" in your result map configuration.

Ted

On 27/01/06, Michael Laccetti <[EMAIL PROTECTED]> wrote:
>
>
>
> Is it possible to do a 'select count(*) from table' and then reference
that
> value in a result map?  I've been searching around and trying to get it to
> work to no avail.
>
>
>
> Mike



Reply via email to