pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: John Barham <jbarham@gmail.com>
To: Diego <diego@unimedijui.com.br>
Cc: pgsql-admin@postgresql.org
Subject: Re: PG Version 8.1
Date: Tue, 22 Nov 2005 19:40:17 +0900
Message-ID: <4f34febc0511220240p77b1bc7ctd7635464bfca8311@mail.gmail.com> (raw)
In-Reply-To: <4383024F.6000406@unimedijui.com.br>
References: <4383024F.6000406@unimedijui.com.br>

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



view thread (2+ messages)  latest in thread

Message-ID: <4f34febc0511220240p77b1bc7ctd7635464bfca8311@mail.gmail.com>
Permalink:  ../4f34febc0511220240p77b1bc7ctd7635464bfca8311@mail.gmail.com/
Also on:    postgresql.org/message-id/4f34febc0511220240p77b1bc7ctd7635464bfca8311@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: jbarham@gmail.com, diego@unimedijui.com.br
  Subject: Re: PG Version 8.1
  In-Reply-To: <4f34febc0511220240p77b1bc7ctd7635464bfca8311@mail.gmail.com>
  References: <4383024F.6000406@unimedijui.com.br> <4f34febc0511220240p77b1bc7ctd7635464bfca8311@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox