postgres query to insert data in a table from other table using combination of two common entries of thecolumns in both tables [closed]
-
21-01-2021 - |
문제
I have 2 tables t1 & t2 both containing 3 columns a,b,c the entries in column 'a' and 'b' are same but ordered differently in t1 & t2. I want to use combination of 'a'&'b' entries of t1, and whichever combination matches with t2 enter the respective data in column 'c' of t1 for that combination to t2.
I want it to do on whole column/table in postgres...can anyone help me. Thanks in advance.
해결책
UPDATE t2
SET t2.c = t1.c
FROM t1
WHERE t1.a = t2.a
AND t1.b = t2.b
제휴하지 않습니다 dba.stackexchange