You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by cmose <cj...@gmail.com> on 2007/03/02 21:22:17 UTC

M:N select and groupBy

Ok, I may be referring to the concept inaccurately as I'm not an sql guru
(non available so the work falls to me).

I'm trying to accomplish the following query:

<resultMap id="totalsByHourResults" class="Statistics" groupBy="timestamp">
     <result property="timestamp" column="timestamp" />
     <result property="typeToTotalBytes" resultMap="Web.typeTotal" />
</resultMap>

<resultMap id="typeToTotal" class="Type">
    <result property="type" column="type" />
    <result property="totalBytes" column="totalBytes"
</resultMap>


<select id="TotalsByHourAndTypeForDateRange" parameterClass="Statistics"
resultMap="totalsByHourResults">
    SELECT SUM(name.size) as totalBytes,
    name.type,
    log.timestamp
    FROM name, log
    WHERE name.name = log.name
    AND UNIX_TIMESTAMP(log.timestamp)) <![CDATA[>=]]>
TRUNCATE((#startTimeInMillis#/1000), 0))
    AND UNIX_TIMESTAMP(log.timestamp)) <![CDATA[<=]]>
TRUNCATE((#startTimeInMillis#/1000), 0))
    GROUP BY HOUR(log.timestamp), type
    ORDER BY HOUR(log.timestamp) desc, type desc
</select>

Running this from an isolated runner class in elcipse gives me a
StackOverFlowError
caused by
gnu.xml.pipeline.Validation.Consumer$ChildrenRecognizer.patchNext

Running this in a servlet under jboss causes the same exception - I'm not
aware of any gnu library in my eclipse build path or deployed with my
application so I'm not positive whether this is ibatis related or not. But
any advice on how to best handle my query concern would be greatly
appreciated.
Thanks

-- 
View this message in context: http://www.nabble.com/M%3AN-select-and-groupBy-tf3335677.html#a9276648
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.