Re: UPDATE A with B
From: <champs_at_hhcs.gov.au>
Date: 14 Feb 93 23:25:00 GMT
Message-ID: <1993Feb15.102500.624_at_hhcs.gov.au>
/ / \ Canberra Australia
\ / / /
\/ / / / MACINTOSH SOFTWARE AXIOM : If you need a manual to operate it
Date: 14 Feb 93 23:25:00 GMT
Message-ID: <1993Feb15.102500.624_at_hhcs.gov.au>
In article <1993Feb12.183538.1002_at_newsserver.rrzn.uni-hannover.de>, rusche_at_iw.uni-hannover.de (Henrik Rusche) writes:
>
> Hey,
>
> here's a problem I would like have to solve only with SQL.
> ----
> With PL/SQL it's simple.
>
> There are two tables (A,B) with the same structure. Let's say
>
> nr number (3), primary key
> text char (50)
>
>
> Now I want to update A with B following this schema :
>
> A.Text = B.Text if A.nr = B.nr
>
>
>
>
> My first try :
>
> UPDATE A
> SET A.Text = B.Text
> WHERE A.Nr = B.Nr;
>
> But that's no solution. Is there a solution - If not why ??????
>
Here's what you need
UPDATE A SET A.Text = (SELECT B.Text FROM B WHERE B.Nr = A.Nr);
Bye for now.
/\ Steven Champness (champs_at_hhcs.gov.au) / \ Dept Health Housing and Community Services / \ Brisbane Queensland / \ via
/ / \ Canberra Australia
\ / / /
\/ / / / MACINTOSH SOFTWARE AXIOM : If you need a manual to operate it
\/ / / it wasn't designed properly in the \/ / first place !\/ Received on Mon Feb 15 1993 - 00:25:00 CET