You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Vijay <vi...@bigtec.org> on 2002/08/23 14:04:29 UTC
Querying for Min Val
Hi,
Can anyone suggest me how do I set the criteria for retreiving the
Min(col_id) for xyz table ?
Thanx
Vijay Kumar Chintala
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Querying for Min Val
Posted by Vijay <vi...@bigtec.org>.
Hi Joe,
Thanx for your suggestion, but I have things that you can possibly throw
some light on
since I am a newbie of framework.
(my queries in line, marked with ==>)
Criteria crit=new Criteria()
.addAsColumn("result", "MIN(" + XyzPeer.COL_ID + ")");
==> here, what does "result" originally contain.
==> does it mean crit.addAsColumn("result", "MIN(" + XyzPeer.COL_ID + ")");
List rs = BasePeer.doSelect(crit);
int result=0;
If(rs.size() > 0){
Record rec=(Record)rs.get(0);
result=rec.getValue("result").asInt();
}
==> I basically did not understand the flow of the code.
==> the part where int result is initialized to "0" after the
==> Query has been made.
Please help me solve this issue, thanx for all the help offered.
Vijay Kumar Chintala
----- Original Message -----
From: "joeblack" <jo...@vtradex.com>
To: "'Turbine Users List'" <tu...@jakarta.apache.org>
Sent: Tuesday, August 27, 2002 1:56 AM
Subject: RE: Querying for Min Val
> Hi, Chintala:
> Try this,
>
> Criteria crit=new Criteria()
> .addAsColumn("result", "MIN(" + XyzPeer.COL_ID + ")");
> List rs = BasePeer.doSelect(crit);
> int result=0;
> If(rs.size() > 0){
> Record rec=(Record)rs.get(0);
> result=rec.getValue("result").asInt();
> }
>
>
> Good luck
>
> Hi,
> Can anyone suggest me how do I set the criteria for retreiving the
> Min(col_id) for xyz table ?
>
> Thanx
>
>
> Vijay Kumar Chintala
>
>
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: Querying for Min Val
Posted by joeblack <jo...@vtradex.com>.
Hi, Chintala:
Try this,
Criteria crit=new Criteria()
.addAsColumn("result", "MIN(" + XyzPeer.COL_ID + ")");
List rs = BasePeer.doSelect(crit);
int result=0;
If(rs.size() > 0){
Record rec=(Record)rs.get(0);
result=rec.getValue("result").asInt();
}
Good luck
Hi,
Can anyone suggest me how do I set the criteria for retreiving the
Min(col_id) for xyz table ?
Thanx
Vijay Kumar Chintala
--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>