Convert boolean field to a 0 or a 1 in a select statement

Поиск
Список
Период
Сортировка
Искать
От
JORGE MALDONADO
Тема
Convert boolean field to a 0 or a 1 in a select statement
Дата
Msg-id
CAAY=A79jns7-tjoZLFFuVhKAPasngRqw29jm2X1CWcRtgRWSWg@mail.gmail.com
Список
Дерево обсуждения
Convert boolean field to a 0 or a 1 in a select statement JORGE MALDONADO <jorgemal1960@gmail.com>
Re: Convert boolean field to a 0 or a 1 in a select statement David G Johnston <david.g.johnston@gmail.com>
Re: Convert boolean field to a 0 or a 1 in a select statement Steve Crawford <scrawford@pinpointresearch.com>
Re: Convert boolean field to a 0 or a 1 in a select statement Sameer Kumar <sameer.kumar@ashnik.com>
Re: Convert boolean field to a 0 or a 1 in a select statement "Zelaznik, Steve" <szelazni@AEGONUSA.com>
Re: Convert boolean field to a 0 or a 1 in a select statement Sameer Kumar <sameer.kumar@ashnik.com>
I have a SELECT statement which contains a boolean field. The result of this query must display '0' for false or '1' for true. I will be generating a text file with this information and a zero or a one is required. I have tried using the CASE statement without success.

CAST(fce_subdivision as CHAR) AS fce_subdivision_aux,
CASE CAST(fce_subdivision as CHAR)
    WHEN 'f' THEN '0'
    WHEN 't' THEN '1'
END

I will very much appreciate your feedback.

Respectfully,
Jorge Maldonado
В списке pgsql-novice по дате отправления
От: Josep Sanchez
Дата:
От: Steve Crawford
Дата:
FAQ