Re: PG Version 8.1

From: John Barham <jbarham(at)gmail(dot)com>
To: Diego <diego(at)unimedijui(dot)com(dot)br>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: PG Version 8.1
Date: 2005-11-22 10:40:17
Message-ID: 4f34febc0511220240p77b1bc7ctd7635464bfca8311@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On 11/22/05, Diego <diego(at)unimedijui(dot)com(dot)br> wrote:
> Hi, i use pg version 8.0 and i have this case:
>
> UPDATE tbpeople
> SET dt_update = '11/22/2005'
> WHERE tbdoctor.id_people = tbpeople.id
>
> But now, in version 8.1, this instrution give me an error:
> [ERROR: missing FROM-clause entry for table "tbdoctor"]
>
> Who can i do now to get the same result?

Try:

UPDATE tbpeople
SET dt_update = '11/22/2005'
FROM tbdoctor
WHERE tbdoctor.id_people = tbpeople.id

or:

UPDATE tbpeople
SET dt_update = '11/22/2005'
WHERE id IN (SELECT id_people FROM tbdoctor)

Note that the FROM clause in UPDATE is a PG extension.

John

> Thanks...
> Diego Ziquinatti

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Diego 2005-11-22 11:34:39 PG Version 8.1
Previous Message Yogvinder Singh 2005-11-22 09:54:30 Max no of commands per transaction