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: Simple update query from joined tables

Re: Simple update query from joined tables

From: Daniel Morgan <dmorgan_at_exesolutions.com>
Date: Thu, 01 Aug 2002 20:55:53 GMT
Message-ID: <3D49A056.EBA5D72A@exesolutions.com>


Cornell news wrote:

> I have had a very difficult time trying to figure this out:
>
> How do I update a table value from another table with matching keys in a
> single UPDATE statement.
>
> Here's a scenario:
>
> Table_A has string fields String_1, and String_2
> Table_B has fields String_3
> Both tables have key fields key1
>
> Write an Update statement that concatenates the values of String_1 and
> String_3 - and places the result in String_2 field for matching (by Key1)
> rows in Table_A.
>
> So, for every matching Table_B row, update Table_A.String_2 field with the
> (Table_A.String_1||Table_B.String_3) value.
>
> TIA,
> Tim C.

Homework homework homework. Who told you guys we would do your homework for you?

All of the elements to the correct solution are in your posting. Here's your hint.

UPDATE table_name
SET column_name = the_concatenated_value WHERE .... IN (
   sub_query goes here);

You do the rest.

Daniel Morgan Received on Thu Aug 01 2002 - 15:55:53 CDT

Original text of this message

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