Re: Problem UPDATE Statement

From: <operationsengineer1(at)yahoo(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Problem UPDATE Statement
Date: 2006-01-04 23:23:15
Message-ID: 20060104232315.24478.qmail@web33313.mail.mud.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

> <operationsengineer1(at)yahoo(dot)com> writes:
> > i'm trying to apply the following UPDATE
> statement:
> > UPDATE t_sn
> > SET t_sn.sn_completed = false
> > WHERE sn = 1
> > AND t_sn.link_id = t_link.link_id
> > AND t_link.job_id = t_job.job_id
> > AND t_job.product_id = t_product.product_id
> > AND t_product.product_id = 118
>
> > i get the following error:
>
> > ERROR: missing FROM-clause entry for table
> "t_link"
>
> You need a "FROM t_link" in there. Prior versions
> of PG were laxer
> about this, but it's been a very long time since
> this command wouldn't
> draw at least a NOTICE ...
>
> regards, tom lane

Tom, thanks. that was it. the basic examples didn't
include the FROM clause - i surmise it isn't required
until you start traversing across linked tables.

this worked...

UPDATE t_sn
SET sn_completed = false
FROM t_link, t_job, t_product
WHERE sn = 1
AND t_sn.link_id = t_link.link_id
AND t_link.job_id = t_job.job_id
AND t_job.product_id = t_product.product_id
AND t_product.product_id = 118

thanks again.


__________________________________________
Yahoo! DSL – Something to write home about.
Just $16.99/mo. or less.
dsl.yahoo.com

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Michael Fuhr 2006-01-05 00:31:53 Re: foreign key's in system tables
Previous Message Sean Davis 2006-01-04 23:15:04 Re: GRANT access rights on rows