Re: UPDATE and outer joins

From: Harry Broomhall <harry(dot)broomhall(at)uk(dot)easynet(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: UPDATE and outer joins
Date: 2003-10-10 13:21:17
Message-ID: 200310101321.OAA30662@haeb.noc.uk.easynet.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Manfred Koizar writes:
> On Wed, 8 Oct 2003 12:23:04 +0100 (BST), Harry Broomhall
> <harry(dot)broomhall(at)uk(dot)easynet(dot)net> wrote:
> >I am currently
> >doing a left outer join into a temporary file, then the UPDATE, but this
> >involves two joins!
>
> UPDATE a
> SET col1 = b.col11, col2 = b.col12
> FROM a AS x LEFT JOIN b ON (x.??? = b.???)
> WHERE a.pk = x.pk;
>
> might not run faster, but at least it is only one statement and you
> don't have to care for temporary tables ...

Many thanks to all who made suggestions. The above gave me enough
clues to get a working UPDATE query working.

It is a shame it can't be done in a single join though!

Regards,
Harry.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message scott.marlowe 2003-10-10 15:37:04 Re: Humor me: Postgresql vs. MySql (esp. licensing)
Previous Message Gene Vital 2003-10-10 13:04:13 Re: Parent Id