Don't forget the new functionality available in 2.1.0
<dynamic prepend="HAVING" open="(" close=")">
<isNotEmpty property="countA">
count > #countA#
</isNotEmpty>
<isNotEmpty prepend="AND" property="countB">
count < #countB#
</isNotEmpty>
</dynamic>
Brandon
On 5/17/05, Ron Grabowski <[EMAIL PROTECTED]> wrote:
> Have you tried this:
>
> <dynamic prepend="HAVING">
> (
> <isNotEmpty property="countA">
> count > #countA#
> </isNotEmpty>
> <isNotEmpty prepend="AND" property="countB">
> count < #countB#
> </isNotEmpty>
> )
> </dynamic>
>
> --- Narasimha Prasad <[EMAIL PROTECTED]> wrote:
> > Here is a problem that I am facing.
> >
> >
> >
> > My parameter class has two counts, say countA and countB and I need
> > to use
> > these in a 'HAVING' clause in the sql query. Both the values could
> > be
> > empty.
> >
> > For eg. if they both have values, the query would look like:
> >
> >
> >
> > Select ….
> >
> > --- from…
> >
> > where….
> >
> > HAVING ( countA > 5 and count B < 10 )
> >
> >
> >
> > I tried using nested dynamic clause, but looks like it is not
> > supported.
> >
> > <dynamic prepend="HAVING">
> >
> > (
> >
> > <isNotEmpty property="countA">
> >
> > count > #countA#
> >
> > </isNotEmpty>
> >
> >
> >
> > <dynamic prepend="AND">
> >
> > <isNotEmpty property="countB">
> >
> > count < #countB#
> >
> > </isNotEmpty>
> >
> > </dynamic>
> >
> > )
> >
> > </dynamic>
> >
> >
> >
> > Is there any other approach to solve this problem, other than going
> > thru and
> > checking every combination of countA and countB ? Any
> > help/suggestion is
> > appreciated
> >
> >
> >
> >
> >
> > Thanks,
> >
> > Prasad
> >
> >
> >
> >
> > --
> > No virus found in this outgoing message.
> > Checked by AVG Anti-Virus.
> > Version: 7.0.308 / Virus Database: 266.11.9 - Release Date: 5/12/2005
> >
> >
>