db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Fischer <fisc...@seitenbau.net>
Subject RE: sort by one column minus another column
Date Mon, 03 Apr 2006 09:46:01 GMT
I reckon you have tried the obvious way, but in the case you did not try it
here is the suggestion:

addAscendingOrderByColumn(SomePeer.STOPTIME + " - " + SomePeer.STARTTIME);

or, if this fails, maybe

addAscendingOrderByColumn("(" +SomePeer.STOPTIME + " - " +
SomePeer.STARTTIME+ ")");

works.

I did not try if this works with Torque 3.2. I am quite sure it will not
work with pre-3.2 Torque.

       Thomas

John Dunne <imirish@alldunne.com> schrieb am 31.03.2006 18:13:55:

> Evening all,
>
> I have a table with two columns; one that stores the start time of a
> session and another with the stoptime of a session, cryptically named,
> STARTTIME and STOPTIME.
>
> Sorting by one or the other is easliy done by addDescendingOrderByColumn
> (or, of course, addAscendingOrderByColumn). But how can I sort by the
> difference between these two columns (i.e. the session duration)? This
> can be done in sql by simply stating ORDER BY STOPTIME - STARTTIME, but
> can I do this using the criteria object?
>
> Thanks in advance,
> John.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message