[英]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.仅当 first_name 列为空时,我才需要将 second_name 值推送到 first_name 列。
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.我希望将 drake 和 jim 移至 first_name 列,并且不应出现在 second_name 列中。其余名称应保持原样。
Looks like好像
update your_table set
first_name = second_name,
second_name = null
where first_name is null;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.