Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread update column with values out another table
Thu, Feb 18 2021 8:56 AMPermanent Link

Kees Lagendijk

I wish to update column A in table X with values from the exact column in table Y.

X                                    Y
A     B     C                     A     B     C
      8      8                     1      8     9
      8      8                     3      9     6

Result

X
A    B     C
1     8     8
3     8     8

Can this be done with a SQL_statement?

Gr,
Kees.
Thu, Feb 18 2021 9:40 AMPermanent Link

Jose Eduardo Helminsky

HPro Informatica

Kees

<<
I wish to update column A in table X with values from the exact column in table Y.

X                                    Y
A     B     C                     A     B     C
      8      8                     1      8     9
      8      8                     3      9     6
Result

X
A    B     C
1     8     8
3     8     8

Can this be done with a SQL_statement?
>>
Yes, but you need at least one relation between two tables

update x set a=y.a
inner join y on (x.b=y.b and x.c=y.c)

In your example there is no relation between two tables. I do not know more about your situation but maybe you can use "insert into".

Regards
Eduardo
Wed, Feb 24 2021 8:02 AMPermanent Link

Kees Lagendijk

Jose Eduardo Helminsky wrote:

Kees

<<
I wish to update column A in table X with values from the exact column in table Y.

X                                    Y
A     B     C                     A     B     C
      8      8                     1      8     9
      8      8                     3      9     6
Result

X
A    B     C
1     8     8
3     8     8

Can this be done with a SQL_statement?
>>
Yes, but you need at least one relation between two tables

update x set a=y.a
inner join y on (x.b=y.b and x.c=y.c)

In your example there is no relation between two tables. I do not know more about your situation but maybe you can use "insert into".

Regards
Eduardo

-------------------------

unfortunately nothing does the trick, so I wrote a little app to do so.

tx for thinking!
Kees
Image