ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mike Jackson" <minini...@gmail.com>
Subject compound conditions
Date Thu, 08 Jun 2006 23:24:54 GMT
I'm trying to build a select that uses a union of two sql statements
both using the between operator in SQL to check for a date between two
values.  I can't get it to work, I keep getting sax exception saying
that I'm missing the end </dynamic> tag.  I've checked the whole file
and I've got balanced tags, so I don't get it.  I'm attaching the
XML/SQL and I'm hoping that someone can set me straight.

<select id="maxAllocated"
resultClass="com.caiso.irr.db.ibatis.DaoImpl$InlineFloat">
select
	max(value) as value
from (
	select
		max( somevalue ) as value
	from
		table_1
<dynamic prepend="WHERE">
<isNotNull property="startDate">
<isNotNull prepend="AND" property="endDate">
        	opr_dt between #startDate# and ( #endDate# - 1/86400 )
</isNotNull>
</isNotNull>
</dynamic>
	union
	select
		max( somevalue ) as value
	from
		table_2
<dynamic prepend="WHERE">
<isNotNull property="startDate">
<isNotNull prepend="AND" property="endDate">
	        opr_dt between #startDate# and ( #endDate# - 1/86400 )
</isNotNull>
</isNotNull>
</dynamic>
	)
</select>

--mikej
-=-----
mike jackson
minininja@gmail.com

Character Density, n.:
        The number of very weird people in the office.

Mime
View raw message