Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 97352 invoked from network); 19 Apr 2006 13:31:52 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 19 Apr 2006 13:31:52 -0000 Received: (qmail 77587 invoked by uid 500); 19 Apr 2006 13:31:32 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 77100 invoked by uid 500); 19 Apr 2006 13:31:29 -0000 Mailing-List: contact user-java-help@ibatis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user-java@ibatis.apache.org Delivered-To: mailing list user-java@ibatis.apache.org Received: (qmail 77089 invoked by uid 99); 19 Apr 2006 13:31:29 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Apr 2006 06:31:29 -0700 X-ASF-Spam-Status: No, hits=0.1 required=10.0 tests=HTML_MESSAGE,HTML_TAG_EXIST_TBODY,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of tschrader@gmail.com designates 66.249.82.194 as permitted sender) Received: from [66.249.82.194] (HELO xproxy.gmail.com) (66.249.82.194) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Apr 2006 06:31:27 -0700 Received: by xproxy.gmail.com with SMTP id s19so704049wxc for ; Wed, 19 Apr 2006 06:31:06 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=H2A5ChE2jaqnhzU6JYKTRJFaiXY67GZMrZqdHWIY1c+jx4KRxpaAiFdVKgVpAjtViVNkNZYpPaqW76CjGjL6abwunkNRQXFjmkNiFrBs2FCw0PADNHxUZz7eTEjiHJSnivUFNgRkh60KDh7Nld0xlXvQtEnSDbCSJ1Yh5u0IkYo= Received: by 10.70.59.15 with SMTP id h15mr5261594wxa; Wed, 19 Apr 2006 06:31:05 -0700 (PDT) Received: by 10.70.92.15 with HTTP; Wed, 19 Apr 2006 06:31:05 -0700 (PDT) Message-ID: <27c1a34f0604190631y38476f0bheaae1590c78604cd@mail.gmail.com> Date: Wed, 19 Apr 2006 09:31:05 -0400 From: "Ted Schrader" To: user-java@ibatis.apache.org Subject: Re: Using Joins In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_5580_9212869.1145453465929" References: X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N ------=_Part_5580_9212869.1145453465929 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi Suresh, Give us your current SQLMap XML for this, and the code for the beans/POJOs involved. Without seeing the configuration of your result maps, it's hard to help you. Ted On 18/04/06, suresh.dodda@wipro.com wrote: > > I am using following select query. > > > > Select * from Emp e, Ddept dt where e.empNo =3D dt.empNo; > > I have defined two result maps. First result map contains list of second > result map. > > The data base has the following data: > > Emp table: > > empNo empName > > 1 xxx > > 2 yyy > > 3 zzz > > Dept table: > > empNo deptName > > 1 dept-xxx-1 > > 1 dept-xxx-2 > > 2 dept-yyy-1 > > 2 dept-yyy-2 > > when i run the query i am getting the four results. > > where i am expecting two results. The resultMap1 should contains > resultMap2 as a list, but for every detail record > > one master record is returned. > ------------------------------ > > *From:* Ted Schrader [mailto:tschrader@gmail.com] > *Sent:* Tuesday, April 18, 2006 8:34 PM > *To:* user-java@ibatis.apache.org > *Subject:* Re: Using Joins > > > > Hi Suresh, > > Give us the select statement you have right now so we can see. > > In the meantime, try: > > SELECT * > FROM Employee e INNER JOIN > Dept d ON e.empId =3D d.empId > > Ted > > On 18/04/06, suresh.dodda@wipro.com < suresh.dodda@wipro.com> wrote: > > > > > > > > > > I am trying find the results from the multiple tables. > > > > > > > > I have Employee table with empId and empname. Dept table with empId an= d > deptno, dept-name > > > > There are only two rows in master and two corresponding rows in the > detail tables. > > > > > > > > When I am using the Inner join I am getting the four results. Where as = I > am expecting two results. Each result inturn should contains > > > > Two detail records. > > > > > > > > Can you please give the query syntax to fetch the data from multiple > table using the join. > > > > > > > > > > > > The information contained in this electronic message and any > attachments to this message are intended for the exclusive use of the > addressee(s) and may contain proprietary, confidential or privileged > information. If you are not the intended recipient, you should not > disseminate, distribute or copy this e-mail. Please notify the sender > immediately and destroy all copies of this message and any attachments. > > > > WARNING: Computer viruses can be transmitted via email. The recipient > should check this email and any attachments for the presence of viruses. = The > company accepts no liability for any damage caused by any virus transmitt= ed > by this email. > > > > www.wipro.com > > > > The information contained in this electronic message and any attachments > to this message are intended for the exclusive use of the addressee(s) an= d > may contain proprietary, confidential or privileged information. If you a= re > not the intended recipient, you should not disseminate, distribute or cop= y > this e-mail. Please notify the sender immediately and destroy all copies = of > this message and any attachments. > > WARNING: Computer viruses can be transmitted via email. The recipient > should check this email and any attachments for the presence of viruses. = The > company accepts no liability for any damage caused by any virus transmitt= ed > by this email. > > www.wipro.com > ------=_Part_5580_9212869.1145453465929 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi Suresh,

Give us your current SQLMap XML for this, and the code fo= r the beans/POJOs involved.  Without seeing the configuration of your = result maps, it's hard to help you.

Ted

On 18/04/06, suresh.dodda@wipro.com <suresh.dodda@wipro.com> wrote:

I am using following select query.=

 

Select * from Emp e, Ddept dt wher= e e.empNo =3D dt.empNo;

I have defined two result maps. Fi= rst result map contains list of second result map.

The data base has the following da= ta:

Emp table:

empNo empName

1&n= bsp;            = ;        xx= x

2&n= bsp;            = ;        yy= y

3&n= bsp;            = ;        zz= z

Dept table:

empNo  deptName

1&n= bsp;            = ;        de= pt-xxx-1

1&= nbsp;          dept-xxx-2

2&n= bsp;            = ;        de= pt-yyy-1

2&= nbsp;          dept-yyy-2

when i run the query i am getting = the four results.

where i am expecting two results. =  The resultMap1 should contains resultMap2 as a list, but for every detail recor= d

one master record is returned.


From: Te= d Schrader [mailto:tschrader@gmail.com] Sent: Tuesday, April 18, 2= 006 8:34 PM
To: user-java@ibatis.apache.org
Subject: Re: Using Joins

 

Hi Suresh,

Give us the select statement you have right now so we can see.

In the meantime, try:

SELECT *
  FROM Employee e INNER JOIN
       Dept d ON e.empId =3D d.empId

Ted

On 18/04/06, suresh.dodda@wipro.c= om < suresh.dodda@wipro.com&g= t; wrote:
>
>            = ;
>  
>
> I am trying find the results from the multiple tables.  
>
>    
>
> I have Employee table with empId and empname.  Dept table wi= th empId and deptno, dept-name  
>
> There are only two rows in master and two corresponding rows in the de= tail tables.  
>
>    
>
> When I am using the Inner join I am getting the four results. Where as= I am expecting two results. Each result inturn should contains   >
> Two detail records.  
>
>    
>
> Can you please give the query syntax to fetch the data from multiple t= able using the join.  
>
>    
>
>          
>
>  The information contained in this electronic message and an= y attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not dissemin= ate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments.
>  
>  WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any viru= s transmitted by this email.
>  
>  www.wipro.com
>  


The information contained in this electronic message and any attachments to= this message are intended for the exclusive use of the addressee(s) and ma= y contain proprietary, confidential or privileged information. If you are n= ot the intended recipient, you should not disseminate, distribute or copy t= his e-mail. Please notify the sender immediately and destroy all copies of = this message and any attachments.=20

WARNING: Computer viruses can be transmitted via email. The recipient shoul= d check this email and any attachments for the presence of viruses. The com= pany accepts no liability for any damage caused by any virus transmitted by= this email.

www.wipro.com

------=_Part_5580_9212869.1145453465929--