update only if single row

From: Frank Bax <fbax(at)execulink(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: update only if single row
Date: 2000-04-06 17:22:16
Message-ID: 3.0.6.32.20000406132216.008a8420@execulink.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Michael Fork 2000-04-06 19:46:50 Re: Datetime as a time_t?
Previous Message Ryan Bradetich 2000-04-06 16:27:00 Datetime as a time_t?