我有一个表products
,其中列description
和description_short
我的部分产品已填空description
,description_short
填充,反之亦然,有些甚至可能已填满。所以我想要做的是将所有已填充的description
复制到description_short
,其中description_short
为空。
用MySQL做最简单的方法是什么?
答案 0 :(得分:0)
很简单:
update products
set description = description_short
where description is null;
commit;
update products
set description_short = description
where description_short is null;
commit;
答案 1 :(得分:0)
update table_name
set description_short =description
where description_short is null and description is not null