繁体   English   中英

当 first_name 列为空时,sql 查询将值从 second_names 列移动到 firstn_name 列

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

下面是我的要求

仅当 first_name 列为空时,我才需要将 second_name 值推送到 first_name 列。

例如,

我希望将 drake 和 jim 移至 first_name 列,并且不应出现在 second_name 列中。其余名称应保持原样。

在此处输入图片说明

好像

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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