db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Van Couvering <david.vancouver...@gmail.com>
Subject Re: Using IN clause with multiple columns
Date Wed, 21 Apr 2010 17:52:46 GMT
Yes, thanks, that should work!

David

On Wed, Apr 21, 2010 at 12:55 AM, Knut Anders Hatlen <Knut.Hatlen@sun.com>wrote:

> On 04/21/10 12:20 AM, David Van Couvering wrote:
> > I have two tables with columns a,b that together comprise the primary
> > key.
> >
> > In Oracle I can do something like DELETE FROM FOO WHERE  (a, b) IN
> > (SELECT a, b FROM BAR WHERE MODIFIED = 1)
> >
> > but in Derby this gives me a syntax error saying Error: Syntax error:
> > Encountered "," at line 1, column XX.
> >
> > The documentation for "IN" also suggests that the subquery can only
> > return a single column.
> >
> > How would I do this, when my tables have a multi-column primary key
> > like above?
> >
>
> Hi David,
>
> Would this work?
>
> DELETE FROM FOO WHERE EXISTS
>    (SELECT * FROM BAR WHERE MODIFIED = 1
>        AND BAR.A = FOO.A AND BAR.B = FOO.B)
>
>
> --
> Knut Anders
>
>


-- 
David W. Van Couvering

http://www.linkedin.com/in/davidvc
http://davidvancouvering.blogspot.com
http://twitter.com/dcouvering

Mime
View raw message