db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "jill han" <j...@bynum.com>
Subject RE: select max(column)
Date Tue, 05 Apr 2005 21:08:14 GMT
I tried to get a max value of a column with type date.
The codes are like:

Criteria crit = new Criteria();
crit.add(XXXXPeer.String, Object, Criteria.EQUAL);
crit.addSelectColumn("MAX(" + XXXXPeer.aDate + ")");
crit.add(XXXXPeer.String, Object, Criteria.EQUAL);
List result = XXXXPeer.doSelect(crit);

But it is not working.
The exception says:
Error: org.apache.torque.TorqueException: Illegal conversion:
com.workingdogs.village.DataSetException: Invalid type for Integer

Does it mean it is type related?
Another question, what is the key difference between Criteria.add and
Criteria.and?

Thanks in advance.

Jill



-----Original Message-----
From: Thomas Fischer [mailto:fischer@seitenbau.net] 
Sent: Tuesday, March 29, 2005 2:01 AM
To: Apache Torque Users List
Subject: RE: select max(column)





Look in the wiki. Ther it is described how to select count(*) from a
table.
The same procedure can be used to find out "max(" + SomePeer.COLUMN_NAME
+")";

http://wiki.apache.org/db-torque/FrequentlyAskedQuestions#head-9317e897d
07dbd597993796d47bfbbe2443bc5bf

    Thomas


"Kintzel Levente" <kintzel.levente@softech.ro> schrieb am 24.03.2005
14:19:30:

>
>    Hi!
>
> I want to determine the max value of a column with Torque. How can I
do
> this? Thanx!
>
>          Levi Kintzel
>
>
>
>
> ---------------------------------------------------------------------
> 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




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