db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonathan Purvis <...@reeltwo.com>
Subject Custom SQL for ORDER BY
Date Wed, 24 Aug 2005 03:00:20 GMT
Is it possible to use an SQL formula for the ORDER BY column with 
Torque?  I was looking generated SQL something like this:

SELECT * FROM rules WHERE rules.type_id=3 ORDER BY abs(rules.year-2003) 
LIMIT 1

(where the 3 and 2003 come from variables).  This would give me the type 
3 Rule object for the year closest to 2003.

I can simulate this by putting the ORDER BY clause in a custom SQL 
Criteria entry, but that's a really ugly way of doing it.


Thanks,

	Jon

---------------------------------------------------------------------
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