cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Gentry <mgen...@masslight.net>
Subject Re: Expression qualifier for comparing two attributes
Date Tue, 30 Aug 2011 15:26:30 GMT
Hi John,

I'm not sure ExpressionFactory can help out, but this should do the trick:

        Expression    expression     =
Expression.fromString("firstAttribute < secondAttribute");
        SelectQuery   query          = new SelectQuery(MyTable.class,
expression);

        context.performQuery(query);

mrg


On Tue, Aug 30, 2011 at 10:43 AM, John Huss <johnthuss@gmail.com> wrote:
> How do I create an Expression (qualifier) that will generate SQL that will
> compare two attributes of the same row, perhaps with a "less than"
> comparison.  For example:
>
> SELECT * FROM MyTable t
> WHERE t.firstAttribute < t.secondAttribute
>
> Thanks,
> John
>

Mime
View raw message