Setting a default value for a select statement without results

From: JORGE MALDONADO <jorgemal1960(at)gmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Setting a default value for a select statement without results
Date: 2013-02-06 00:23:10
Message-ID: CAAY=A7_cM2ZrO9oD=_pbuX6vdNiVST3iXLfRDZ5_YHASoABZBg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Anton Gavazuk 2013-02-06 00:35:03 Re: Setting a default value for a select statement without results
Previous Message Dev Kumkar 2013-02-05 17:12:16 Querying multiple database