sql - Update query that will set specific columns in a record with values from another record of same table -
look @ query;
update user_data set old_status= 'snnnns', user_group='15', default_rate='default', entity_num='1001' user_name='dasu';
i know write query , result, dont want writing values. these values record user_name 'sys' in same table. want query update these particular columns in 'dasu' values 'sys'.
any idea?
in oracle, can use merge
self-join. alternatively, can write correlated subqueries in update
:
update user_data set (old_status, user_group, default_rate, entity_num) = (select old_status, user_group, default_rate, entity_num user_data user_name = 'sys') user_name='dasu';
Comments
Post a Comment