You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by fr...@free.fr on 2010/01/27 09:11:08 UTC

Writing subqueries

Hi all.
As a new iBatis user, I'd like to know how is it possible to write a statement
like this one:


INSERT into table1 (ville, nom, datn)
SELECT l.ville, l.nom, v.datn
from mtab l, dpart b, table3 v
where b.nom=l.nom
and (b.nom,v.datn) not in (SELECT x.nom,x.datn from table1 x)


Any example of an Insert or Update subquery would be helpful.
Thanks in advance.

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


Re: Writing subqueries

Posted by Nathan Maves <na...@gmail.com>.
yes

On Jan 27, 2010, at 1:11 AM, fran.cois@free.fr wrote:

> 
> Hi all.
> As a new iBatis user, I'd like to know how is it possible to write a statement
> like this one:
> 
> 
> INSERT into table1 (ville, nom, datn)
> SELECT l.ville, l.nom, v.datn
> from mtab l, dpart b, table3 v
> where b.nom=l.nom
> and (b.nom,v.datn) not in (SELECT x.nom,x.datn from table1 x)
> 
> 
> Any example of an Insert or Update subquery would be helpful.
> Thanks in advance.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
> 

Nathan Maves
nathan.maves@gmail.com




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


Re: AW: Writing subqueries

Posted by fr...@free.fr.
I was waiting for something more complex !
Thanks for your reply... and for the advice !
Best regards.


Selon Stephen Friedrich <st...@fortis-it.eu>:

> The statement you gave is a single statement.
> iBatis doesn't care (or know) how many subqueries it contains.
> You can simply use a single <update> tag:
>
> <update id="insertFoo">
>    INSERT into table1 (ville, nom, datn)
>    SELECT l.ville, l.nom, v.datn
>    from mtab l, dpart b, table3 v
>    where      b.nom=l.nom
>          and (b.nom,v.datn) not in (SELECT x.nom,x.datn from table1 x)
> </update>
>
> I recommend just giving ibatis a testdrive and actually playing with it a
> little.
>
> -----Ursprüngliche Nachricht-----
> Von: F. TRAORE [mailto:fran.cois@free.fr]
> Gesendet: Freitag, 29. Januar 2010 13:07
> An: user-java@ibatis.apache.org
> Betreff: Re: Writing subqueries
>
>
> > Thats just an update query. I'm not sure what the difficulty you have is?
> >
> Just an update query ? Two select into one insert ? Excuse me for
> disturbing you if you're an iBatis expert and please don't lose your
> time more longer...
> As I said I'm new on iBatis and just want to know how to to embed a
> statement within another.
> Thanks for any example.
>
>
>




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


AW: Writing subqueries

Posted by Stephen Friedrich <st...@fortis-it.eu>.
The statement you gave is a single statement.
iBatis doesn't care (or know) how many subqueries it contains.
You can simply use a single <update> tag:

<update id="insertFoo">
   INSERT into table1 (ville, nom, datn)
   SELECT l.ville, l.nom, v.datn
   from mtab l, dpart b, table3 v
   where      b.nom=l.nom
         and (b.nom,v.datn) not in (SELECT x.nom,x.datn from table1 x)
</update>

I recommend just giving ibatis a testdrive and actually playing with it a little.

-----Ursprüngliche Nachricht-----
Von: F. TRAORE [mailto:fran.cois@free.fr] 
Gesendet: Freitag, 29. Januar 2010 13:07
An: user-java@ibatis.apache.org
Betreff: Re: Writing subqueries


> Thats just an update query. I'm not sure what the difficulty you have is?
>   
Just an update query ? Two select into one insert ? Excuse me for 
disturbing you if you're an iBatis expert and please don't lose your 
time more longer...
As I said I'm new on iBatis and just want to know how to to embed a 
statement within another.
Thanks for any example.



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


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


Re: Writing subqueries

Posted by "F. TRAORE" <fr...@free.fr>.
> Thats just an update query. I'm not sure what the difficulty you have is?
>   
Just an update query ? Two select into one insert ? Excuse me for 
disturbing you if you're an iBatis expert and please don't lose your 
time more longer...
As I said I'm new on iBatis and just want to know how to to embed a 
statement within another.
Thanks for any example.



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


Re: Writing subqueries

Posted by Wesley Acheson <we...@gmail.com>.
Thats just an update query. I'm not sure what the difficulty you have is?

On Wed, Jan 27, 2010 at 9:11 AM,  <fr...@free.fr> wrote:
>
> Hi all.
> As a new iBatis user, I'd like to know how is it possible to write a statement
> like this one:
>
>
> INSERT into table1 (ville, nom, datn)
> SELECT l.ville, l.nom, v.datn
> from mtab l, dpart b, table3 v
> where b.nom=l.nom
> and (b.nom,v.datn) not in (SELECT x.nom,x.datn from table1 x)
>
>
> Any example of an Insert or Update subquery would be helpful.
> Thanks in advance.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
>
>

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