Re: Setting a default value for a select statement without results

From: Anton Gavazuk <antongavazuk(at)gmail(dot)com>
To: JORGE MALDONADO <jorgemal1960(at)gmail(dot)com>
Cc: "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Setting a default value for a select statement without results
Date: 2013-02-06 00:35:03
Message-ID: -1442825864597553886@unknownmsgid
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-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(at)gmail(dot)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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Ian Lawrence Barwick 2013-02-06 00:48:17 Re: Setting a default value for a select statement without results
Previous Message JORGE MALDONADO 2013-02-06 00:23:10 Setting a default value for a select statement without results