From torque-user-return-6377-apmail-db-torque-user-archive=db.apache.org@db.apache.org Wed Aug 24 03:00:27 2005 Return-Path: Delivered-To: apmail-db-torque-user-archive@www.apache.org Received: (qmail 90298 invoked from network); 24 Aug 2005 03:00:27 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 24 Aug 2005 03:00:27 -0000 Received: (qmail 81894 invoked by uid 500); 24 Aug 2005 03:00:25 -0000 Delivered-To: apmail-db-torque-user-archive@db.apache.org Received: (qmail 81865 invoked by uid 500); 24 Aug 2005 03:00:25 -0000 Mailing-List: contact torque-user-help@db.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Apache Torque Users List" Reply-To: "Apache Torque Users List" Delivered-To: mailing list torque-user@db.apache.org Received: (qmail 81852 invoked by uid 99); 24 Aug 2005 03:00:24 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 23 Aug 2005 20:00:24 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (asf.osuosl.org: local policy) Received: from [210.55.139.211] (HELO giger.nz.reeltwo.com) (210.55.139.211) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 23 Aug 2005 20:00:41 -0700 Received: from [10.0.201.11] (duro.nz.reeltwo.com [10.0.201.11]) by giger.nz.reeltwo.com (8.12.8/8.12.8) with ESMTP id j7O30Kx4012189 for ; Wed, 24 Aug 2005 15:00:20 +1200 Message-ID: <430BE2C4.4010204@reeltwo.com> Date: Wed, 24 Aug 2005 15:00:20 +1200 From: Jonathan Purvis User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.11) Gecko/20050728 X-Accept-Language: en-nz, en-gb, en, en-us MIME-Version: 1.0 To: torque-user@db.apache.org Subject: Custom SQL for ORDER BY Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N 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