db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andres Quijano - Rizonet" <and...@rizo.net>
Subject RE: Criteria question...
Date Mon, 19 Jan 2004 12:11:33 GMT
I use this to get a random row from a table:

Criteria crit = new Criteria();
crit.addAsColumn("rnd", "rand()");
crit.addAscendingOrderByColumn("rnd");
crit.setLimit(1);
YourTableNamePeer.doSelect(crit);

hope it helps

-----Original Message-----
From: William Wong [mailto:william.wong@openwave.com] 
Sent: Domingo, 18 de Enero de 2004 10:32 p.m.
To: torque-user@db.apache.org
Subject: Criteria question...


Hi All,

Is there any easy way to convert below Mysql select statement into a
Criteria statement?

select * from name order by rand() limit 1;

Can I use Criteria.CUSTOM to achieve it?

Thank you in advance.

Regards,
William


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



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