From: Anton Gavazuk <antongavazuk@gmail.com>
To: JORGE MALDONADO <jorgemal1960@gmail.com>
Cc: pgsql-sql@postgresql.org <pgsql-sql@postgresql.org>
Subject: Re: Setting a default value for a select statement without results
Date: Wed, 6 Feb 2013 00:35:03 +0000
Message-ID: <-1442825864597553886@unknownmsgid> (raw)
In-Reply-To: <CAAY=A7_cM2ZrO9oD=_pbuX6vdNiVST3iXLfRDZ5_YHASoABZBg@mail.gmail.com>
References: <CAAY=A7_cM2ZrO9oD=_pbuX6vdNiVST3iXLfRDZ5_YHASoABZBg@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-sql>
Hi Jorge,
Look on http://www.postgresql.org/docs/8.1/static/functions-conditional.html
Thanks,
Anton
On Feb 6, 2013, at 0:23, JORGE MALDONADO <jorgemal1960@gmail.com> wrote:
> I have an UPDATE query with the following general structure:
>
> UPDATE table1 SET (SELECT field FROM table2 WHERE conditions ORDER BY order_field LIMIT 1)
>
> Is it possible to assign a default value in case no results are returned by the SELECT statement?
>
> Respectfully,
> Jorge Maldonado
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
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: antongavazuk@gmail.com, jorgemal1960@gmail.com
Subject: Re: Setting a default value for a select statement without results
In-Reply-To: <-1442825864597553886@unknownmsgid>
* 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