Thread: PG Version 8.1

PG Version 8.1

From
Diego
Date:
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?

Thanks...
Diego Ziquinatti

Re: PG Version 8.1

From
John Barham
Date:
On 11/22/05, Diego <diego@unimedijui.com.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