简体   繁体   中英

sql query to move values from second_names column to firstn_name column when first_name column is null

below is my requirement

i need to push second_name values to first_name column only when first_name columns are null.

for example,

i want drake and jim to be moved to first_name column and should not be present in second_name column.Rest of the names should be same as it is.

在此处输入图片说明

Looks like

update your_table set
  first_name  = second_name,
  second_name = null
where first_name is null;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM