簡體   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