ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Larry Meadors <lmead...@apache.org>
Subject Re: SQL query with "greater and equal" and "less and equal"
Date Mon, 23 Jan 2006 12:48:29 GMT
This will work, too:

<select id="getRawAttendanceRecordListRange"
resultMap="rawAttendanceRecordResult"
parameterClass="searchAttendanceRecords">
   select * from RAWATTENDANCERECORD
   where logDate &gt;= #fromDate#
     and logDate &lt;= #toDate#
</select>

Larry


On 1/22/06, Jeff Butler <jeffgbutler@gmail.com> wrote:
> <select id="getRawAttendanceRecordListRange"
> resultMap="rawAttendanceRecordResult"
> parameterClass="searchAttendanceRecords">
>    select * from RAWATTENDANCERECORD
>    where logDate <![CDATA[ >= ]]> #fromDate#
>      and logDate <![CDATA[ <= ]]> #toDate#
> </select>
>
> You need to enclose the <= and >= operators in XML CDATA sections to avoid
> breaking the XML syntax.
>
> The <isGreaterEqual> and is <isLessEqual> tags are for generating dynamic
> SQL based on run time values - not what you're doing here.
>
> Jeff Butler
>
>
>
> On 1/22/06, Erik Kron <erik_kron@yahoo.com> wrote:
> > I have a table called rawattendancerecord.
> >
> > There is a column in the table called logDate;
> >
> > I want to be able to return log dates between 2 give
> > search date criteria. E.g. dates between fromDate and
> > toDate.
> >
> >
> > I can do a search from the command line (mysql) with
> > the following commands to return the right values.
> > e.g.
> >
> > select * from rawattendancerecord where
> > logDate>='2005-10-10' and logDate<='2006-01-15';
> >
> >
> > How can I represent a similar query in ibatis?
> >
> > In my RawAttendanceRecord.xml: (I am passing my search
> > range (from and to value) with fromDate to toDate
> > (properties) in the searchAttendanceRecords class.
> >
> > <select id="getRawAttendanceRecordListRange"
> > resultMap="rawAttendanceRecordResult"
> > parameterClass="searchAttendanceRecords">
> >    select * from RAWATTENDANCERECORD where ...
> >
> > </select>
> >
> > I just do not know the syntax to use. I have read
> > about <isGreaterEqual> and <isLessEqual>. But I cannot
> > seem to be able to use them appropriately.
> >
> > Any help will be appreciated. I tried to search the
> > FAQ section, but the site is currently down.
> >
> > Regards,
> > Erik
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Tired of spam?  Yahoo! Mail has the best spam protection around
> > http://mail.yahoo.com
> >
>
>

Mime
View raw message