繁体   English   中英

如何在sql的新列中插入多列的内容?

[英]How to insert content of multiple columns into a new column in sql?

我想组合两列的内容并将其插入新列。

但它不起作用。 例:

create table car(
   id bigint NOT NULL,
   manufacture character varying(255),
   number character varying(255),
   result character varying(255)
)

insert into car (result)
select concat(manufacture, ' ', number) from car

结果:

ERROR:  NULL-Value in column „id“ error Not-Null-Constraint
DETAIL:  Failed line contains (null, null, null, bmw 123).

如何更新特定行,并保留所有其他值?

update car set result = concat(manufacture, ' ', number)

暂无
暂无

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

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