pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Frank Bax <fbax@execulink.com>
To: pgsql-sql@postgresql.org
Subject: update only if single row
Date: Thu, 06 Apr 2000 13:22:16 -0400
Message-ID: <3.0.6.32.20000406132216.008a8420@execulink.com> (raw)

Here's the way I do it now:

select * from contact where email ~* 'rvro';
if I get a single row in the result then I enter:
update contact set bounce=1 where  email ~* 'rvro';

Can I combine this into a single SQL statement with the following
requirements:
1) the update is only performed if a single row is selected
2) I only enter the selection string ('rvro' in this case) once in the
command?

Frank



view thread (8+ messages)  latest in thread

Message-ID: <3.0.6.32.20000406132216.008a8420@execulink.com>
Permalink:  ../3.0.6.32.20000406132216.008a8420@execulink.com/
Also on:    postgresql.org/message-id/3.0.6.32.20000406132216.008a8420@execulink.com

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: fbax@execulink.com
  Subject: Re: update only if single row
  In-Reply-To: <3.0.6.32.20000406132216.008a8420@execulink.com>
  References: <3.0.6.32.20000406132216.008a8420@execulink.com>

* 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