[GENERAL] Re: [GENERAL] How tö select a column? - Mailing list pgsql-general

From David G. Johnston
Subject [GENERAL] Re: [GENERAL] How tö select a column?
Date
Msg-id CAKFQuwYt+EKF5Lefzgfe5Fd3b1-3iP5424Nm2ALwHURuAyzr0Q@mail.gmail.com
Whole thread Raw
In response to [GENERAL] How tö select a column?  (Egon Frerich <egon@frerich.eu>)
List pgsql-general
On Sat, Feb 18, 2017 at 9:33 AM, Egon Frerich <egon@frerich.eu> wrote:
I have a table with two columns with type money. If column 'a' has an
amount > 0 then this amount is wanted else the amount from column 'b'.


SELECT CASE WHEN a > 0 THEN a ELSE b END AS a_or_b FROM tbl​;

David J.

pgsql-general by date:

Previous
From: Egon Frerich
Date:
Subject: [GENERAL] How tö select a column?
Next
From: Nikolay Petrov
Date:
Subject: [GENERAL] Unexpected WAL-archive restore behaviour