From: | Bruno Wolff III <bruno(at)wolff(dot)to> |
---|---|
To: | MichaelHoeller(at)t-online(dot)de |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: how to update with a join? |
Date: | 2005-09-10 18:03:52 |
Message-ID: | 20050910180352.GC11142@wolff.to |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On Sat, Sep 10, 2005 at 18:56:10 +0200,
MichaelHoeller(at)t-online(dot)de wrote:
> Hello all,
>
> thanks for the answere to the prev. thread. With the help of them
> I solved the problme I used "not like" instead of <> and this leads
> to a problem. This works for me:
>
> update stamm
> set code = replace (code, 'k' , '')
> where code like '%k%' and code <> '%V%';
>
> I would still be interested to learn how to update a row when the result
> set is only reachable via a join.
You can use 'FROM' in an update statement to include other tables.
For example (doing a pointless self join):
UPDATE stamm
SET code = replace (code, 'k' , '')
FROM stamm a
WHERE a.code = code
;
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2005-09-10 18:43:31 | Re: a "catch all" type ... such a thing? |
Previous Message | Bruno Wolff III | 2005-09-10 17:57:33 | Re: how to have 2 select creteria on one column? |