Re: How to return a default value if no result - Mailing list pgsql-novice

From David G Johnston
Subject Re: How to return a default value if no result
Date
Msg-id 1408716445855-5815860.post@n5.nabble.com
Whole thread Raw
In response to Re: How to return a default value if no result  ("Rob - TEAM Systems Ltd" <rob@teamsystems.co.uk>)
Responses Re: How to return a default value if no result  ("Rob - TEAM Systems Ltd" <rob@teamsystems.co.uk>)
List pgsql-novice
Rob Northcott wrote
> Is there a nice way of forcing a default result somehow?

The Coalesce function is your friend:

SELECT COALESCE( (SELECT subquery), <default> )

David J.



--
View this message in context:
http://postgresql.1045698.n5.nabble.com/How-to-return-a-default-value-if-no-result-tp5815850p5815860.html
Sent from the PostgreSQL - novice mailing list archive at Nabble.com.


pgsql-novice by date:

Previous
From: "Rob - TEAM Systems Ltd"
Date:
Subject: Re: How to return a default value if no result
Next
From: "Rob - TEAM Systems Ltd"
Date:
Subject: Re: How to return a default value if no result