Re: Update Query Problem

From: Jaime Casanova <systemguards(at)gmail(dot)com>
To: "operationsengineer1(at)yahoo(dot)com" <operationsengineer1(at)yahoo(dot)com>
Cc: "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Update Query Problem
Date: 2005-12-13 17:43:26
Message-ID: c2d9e70e0512130943g5686929qa658c666b8d63fac@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On 12/13/05, operationsengineer1(at)yahoo(dot)com
<operationsengineer1(at)yahoo(dot)com> wrote:
> the following update query...
>
> UPDATE t_job_number
> SET contract_id = 30
> WHERE t_serial_number.serial_number_id = 78
> AND t_serial_number.job_number_id =
> t_job_number.job_number_id
>
> yields the following chastisement...
>
> ERROR: missing FROM-clause entry for table
> "t_serial_number"
>
> can anyone point in the right direction? requiring a
> from clause in this update seems a little bizarre to
> me - so i'm sure i've botched something up pretty
> good.
>
> tia...
>

UPDATE t_job_number SET contract_id = 30
WHERE job_number_id IN (SELECT job_number_id
FROM t_serial_number
WHERE serial_number_id = 78);

or add a FROM clause to the update

--
Atentamente,
Jaime Casanova
(DBA: DataBase Aniquilator ;)

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Andreas Kretschmer 2005-12-13 17:43:55 Re: Update Query Problem
Previous Message s anwar 2005-12-13 17:37:24 How to recover space from a failed cluster