Answer the question
In order to leave comments, you need to log in
Merging two tables into one postrgesql?
Conventionally, there are two tables:
create table target
(
"id" serial primary key,
"title" varchar(50) not null,
"poster" varchar(100) default null
);
create table source
(
"id" serial primary key,
"posterId" serial REFERENCES target (id)
"poster" varchar(100) default null
);
INSERT INTO target ("poster")
SELECT "poster"
FROM source
WHERE source."posterId" = target.id
Answer the question
In order to leave comments, you need to log in
Programmed in HTML, thanks for the tip to a friend who ran away somewhere
UPDATE target AS t
SET poster = s.poster
FROM source AS s
WHERE s."posterId" = t.id
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question