db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tulsi Das <quixote_...@yahoo.com>
Subject Alias order by problem...
Date Tue, 07 Oct 2003 21:31:46 GMT
Hello, using Torque with MySQL I want to do an "order by" using some
alias column and not a table column. That is, something like this:

SELECT actividad.*, MATCH (actividad.ACTIVIDAD) AGAINST ('futbol') AS
score FROM actividad 
WHERE MATCH (actividad.ACTIVIDAD) AGAINST ('futbol') order by score

that is, using full text seach, sort by the score of that result.

To achieve that, I use the following code:

String matchString = "MATCH ("+ActividadPeer.ACTIVIDAD+") AGAINST

Criteria crit = new Criteria();		
crit.add(ActividadPeer.ACTIVIDAD, (Object)matchString,
crit.addAsColumn("score", matchString);

List actividades = ActividadPeer.doSelect(crit);

If I comment the addDescendingOrderByColumn line, everything goes well
and the full text goes ok, but when trying to do the order by, I get
the following error:

org.apache.torque.TorqueException: Malformed column name in Criteria
order by: 'score DESC' is not of the form 'table.column'

Now... I know it what it means, but I don´t want a table.column form,
since it´s an alias!

Any input on the subject will be much appreciated



Internet GRATIS es Yahoo! Conexión
4004-1010 desde Buenos Aires. Usuario: yahoo; contraseña: yahoo
Más ciudades: http://conexion.yahoo.com.ar

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

View raw message