Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: This is not error

Re: This is not error

From: Mark D Powell <mark.powell_at_eds.com>
Date: 27 Aug 2001 06:35:36 -0700
Message-ID: <178d2795.0108270535.49eda9c8@posting.google.com>


"Adam Boczek" <adam.boczek_at_NO_SPAM_gft-solutions.de> wrote in message news:<998905873.448009_at_tux2.ham.acs-gmbh.de>...
> Type error in my post, should be:
>
> UPDATE table1
> SET table1.x = table2.x
> WHERE table1.id = table2.id;
>
> --
>
> Greets,
> Adam
>
> -------------------------------------------
> Adam Boczek
> IT Consultant
> GFT Solutions GmbH
> adam.boczek_at_gft-solutions.de
> -------------------------------------------
>
> "Adam Boczek" <adam.boczek_at_NO_SPAM_gft-solutions.de> schrieb im Newsbeitrag
> news:998905644.129215_at_tux2.ham.acs-gmbh.de...
> > I have two tables:
> > table1 with fields "id" and "x"
> > table2 with fields "id" and "x"
> >
> > I'd like to update value of field "x" from table1 with value of field "x"
> > from table2 where "id" of table1 = "id" od table2. I've try this
> statement:
> >
> > UPDATE table1
> > SET table1.x = table2.x
> > WHERE table1.id = table.id;
> >
> > but I always receive error that the name of feld is not correct. How can
> > write such easy statement? In Access I've used "left join" and so on
> without
> > any problems...
> > Help
> >
> > Greets,
> > Adam
> >

Try changing SET table1.x = table2.x
to SET tabel1.x = (select tabble2.x from table2 b where b.key = a.key)

and change the where condition to
where exists (select 'x' from table2 c where c.key = a.key)

where 'a' is the label for table1

Potentially you can use an in clause instead of the exists clause. Which clause performs better depends on the percentage of rows that meet the where conditon, higher favors in clause.

Received on Mon Aug 27 2001 - 08:35:36 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US