| From: | pw <p(dot)willis(at)telus(dot)net> |
|---|---|
| To: | pgsql-general(at)postgresql(dot)org |
| Subject: | Re: (THE_ANSWER) What is the syntax for UPDATE from one |
| Date: | 2004-03-12 20:58:36 |
| Message-ID: | 4052247C.1090001@telus.net |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
Thanks to everyone who helped.
I found the solution just by tooling with the SQL syntax.
FYI, the correct syntax is:
UPDATE destination_table SET dest_column=A FROM
(SELECT src_column as A, src_link_col FROM src_table) AS J
WHERE src_link_col=dst_link_col;
Pete
pw wrote:
>
> Hello,
>
> What is the proper syntax for updating a column inone table from
> a column in another?
>
> I have tried this:
>
> UPDATE destination_table FROM source_table SET
> destination_table.column_one = source_table.column_b WHERE constraint;
>
> This fails, so I must have the syntax incorrect.
>
> Thanks for any help,
>
> Pete
>
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faqs/FAQ.html
>
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Jerry LeVan | 2004-03-12 21:12:17 | Re: Where are PL/pgsql definitions kept? |
| Previous Message | Richard Huxton | 2004-03-12 20:47:31 | Re: Where are PL/pgsql definitions kept? |