pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Hoeller <MichaelHoeller@t-online.de>
To: pgsql-sql@postgresql.org
Subject: how to update with a join?
Date: Sat, 10 Sep 2005 18:47:48 +0200
Message-ID: <200509101847.48765.MichaelHoeller@t-online.de> (raw)

Hello 

I like to delete "k" from a string with the statement 
update stamm set code = replace (code, 'k' , '');

But the only way to get the canditates I want to update is the following 
statement. It seems that I can not update when I do a join. 

Is there a way around it? With google I found a hint that a subselect
could help but there was no exsample ... And I did not found out how 
to do this.

select a.code 
from stamm a 
where 
a.skart in ( 
	(select skart 
	from stamm 
	where code like '%k%') 
	) 
and a.code not like '%V%';

I would be happy about a hint.

Thanks a lot 
Michael



view thread (3+ messages)  latest in thread

Message-ID: <200509101847.48765.MichaelHoeller@t-online.de>
Permalink:  ../200509101847.48765.MichaelHoeller@t-online.de/
Also on:    postgresql.org/message-id/200509101847.48765.MichaelHoeller@t-online.de

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: MichaelHoeller@t-online.de
  Subject: Re: how to update with a join?
  In-Reply-To: <200509101847.48765.MichaelHoeller@t-online.de>

* 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