This issue has arised many, many times. Check old posts, there is a patch
you need to do to BasePeer class
---------- Original Message -----------
From: "Michael Schmitt" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tue, 10 Feb 2004 13:24:46 +0100
Subject: How to use column in order by that does not exist in table?
> Hi,
> I am trying to do something like the following:
>
> SELECT band_id, MAX(date_inserted) FROM
> band_comment GROUP BY band_id ORDER BY 2
>
> or
>
> SELECT band_id, MAX(date_inserted) AS inserted FROM
> band_comment GROUP BY band_id ORDER BY inserted
>
> I am using a Criteria in the following way:
>
> Criteria c = new Criteria();
>
> c.addSelectColumn(CommentPeer.BAND_ID);
> c.addAsColumn("inserted","MAX(" + CommentPeer.DATE_INSERTED + ")");
>
> c.addAscendingOrderByColumn("inserted");
>
> List comments = BasePeer.doSelect(c);
>
> Executing this, a TorqueException will be thrown with the message:
> Malformed column name in Criteria order by:
> 'inserted ASC' is not of the form 'table.column'
>
>
> Does anyone know how to use a column in the 'order by' clause that
> does not exist in the table?
>
> greetings,
> michael
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
------- End of Original Message -------
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]