db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Schmitt" <mi.schm...@gmx.de>
Subject How to use column in order by that does not exist in table?
Date Tue, 10 Feb 2004 12:24:46 GMT
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: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message