0
UPDATE temp_test
 SET country_i = (select a.country_code from temp_test2 a,temp_test c
                       where c.country_i is null and 
            a.active = 'A' and c.created_by = a.partner_by)
Lalit Kumar B
  • 47,486
  • 13
  • 97
  • 124
  • here is answer to your question http://stackoverflow.com/questions/3361768/how-to-copy-data-from-one-column-to-other-column – sanoj lawrence Apr 13 '15 at 06:34

2 Answers2

1

You could use a MERGE statement. It is easy to understand.

MERGE INTO temp_test t
USING temp_test2 u
ON (t.created_by = u.partner_by)
WHEN MATCHED THEN 
UPDATE SET
   t.country_i = u.country_code
   WHERE t.country_i IS NULL
   AND   u.active = 'A';
Lalit Kumar B
  • 47,486
  • 13
  • 97
  • 124
0
UPDATE temp_test c SET country_i = (select a.country_code from temp_test2 a where a.active = 'A' and c.created_by = a.partner_by) where c.country_i is null;

In my mind it should work...

Dart XKey
  • 54
  • 3