db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sheng Guo <sh...@in.tum.de>
Subject Re: sql translation
Date Wed, 17 Mar 2004 21:00:46 GMT
Hello,

Thanks for your reply, and I tried the following code:

      Criteria crit = new Criteria();
      crit.addJoin(SysContactUserPeer.SYS_CONTACT_ID, SysContactPeer.ID);

      crit.addAscendingOrderByColumn(SysContactUserPeer.ID);

      try {
        java.util.List record = SysContactUserPeer.doSelect(crit);
      
        return record;
      }....
But as the result, I only got all the data from the table 
sys_contact_user, with an object data, and I suppose it was the content 
of the table sys_contact.

So, actually I need only three values for each record, the NAME value 
from sys_contact, the FIRSTNAME value from sys_contact_user, and the 
LASTNAME value from the sys_contact_user. How can I make this "select"?  
I think, it should not be SysContactUserPeer.doSelect(crit).

your sincerely

Guo


Luca Zappa wrote:

>Hi Guo,
>  can you send us the xml schema of your db?
>
>If you define correctly foreing keys, that query is just implemented.
>Otherwise you can use Critera:
>
>Criteria c = new Criteria();
>c.addJoin(Table1Peer.PUBLISHER_ID,Table2Peer.PUBLISHER_ID);
>List rows = BasePeer.doSelect(c);
>
>Regards,
>  Luca
>
>-----Original Message-----
>From: Sheng Guo [mailto:sheng@in.tum.de] 
>Sent: Wednesday, March 17, 2004 9:03 PM
>To: torque-user@db.apache.org
>Subject: sql translation
>
>Hello,
>
>I am a new user of torque, and I would like to translate the following sql
>statement into torque,
>
>select c.name, u.firstname, u.lastname
>from   sys_contact c,  sys_contact_user u
>where  u.sys_contact_id =  c.id
>
>Could you please help me?
>
>yours sincerely
>
>Guo
>
>
>---------------------------------------------------------------------
>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