From: | "Mike G(dot)" <mike(at)thegodshalls(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Update table with data from another table |
Date: | 2006-02-09 20:21:16 |
Message-ID: | 20060209202116.GA3080@localhost.localdomain |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi,
I was hoping to update the results of one table with data from another table. I have done this many times before using UPDATE X SET Z FROM Y.
The catch this time is the tables involved both have the same column names, same table names but reside in different schemas.
UPDATE schema1.A
SET col = z.col
FROM schema2.A z
WHERE z.match = match;
I can't get postgres to accept the above or any variation such as adding the full schema and table name to each column. I also can't seem to declare an alias for the destination table (UPDATE schema1.A w SET w.col = z.col).
As a workaround I will rename one of the tables temporarily. If someone has been able to get this to work I would appreciate any tips to reference for next time.
Mike
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2006-02-09 20:23:59 | Re: [GENERAL] Sequences/defaults and pg_dump |
Previous Message | Alvaro Herrera | 2006-02-09 20:16:10 | Re: [GENERAL] Sequences/defaults and pg_dump |