X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9F2F8D89B5 for ; Sat, 10 Sep 2005 15:03:44 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 70326-02 for ; Sat, 10 Sep 2005 18:03:42 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.197.194]) by svr1.postgresql.org (Postfix) with SMTP id BEBD2D8997 for ; Sat, 10 Sep 2005 15:03:42 -0300 (ADT) Received: (qmail 11618 invoked by uid 500); 10 Sep 2005 18:03:52 -0000 Date: Sat, 10 Sep 2005 13:03:52 -0500 From: Bruno Wolff III To: MichaelHoeller@t-online.de Cc: pgsql-sql@postgresql.org Subject: Re: how to update with a join? Message-ID: <20050910180352.GC11142@wolff.to> Mail-Followup-To: Bruno Wolff III , MichaelHoeller@t-online.de, pgsql-sql@postgresql.org References: <200509101847.48765.MichaelHoeller@t-online.de> <200509101856.10905.MichaelHoeller@t-online.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200509101856.10905.MichaelHoeller@t-online.de> User-Agent: Mutt/1.5.6i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 required=5 tests=[AWL=0.006] X-Spam-Level: X-Archive-Number: 200509/112 X-Sequence-Number: 22659 On Sat, Sep 10, 2005 at 18:56:10 +0200, MichaelHoeller@t-online.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 ;