Convert boolean field to a 0 or a 1 in a select statement - Mailing list pgsql-novice

From JORGE MALDONADO
Subject Convert boolean field to a 0 or a 1 in a select statement
Date
Msg-id CAAY=A79jns7-tjoZLFFuVhKAPasngRqw29jm2X1CWcRtgRWSWg@mail.gmail.com
Whole thread Raw
Responses Re: Convert boolean field to a 0 or a 1 in a select statement
Re: Convert boolean field to a 0 or a 1 in a select statement
Re: Convert boolean field to a 0 or a 1 in a select statement
List pgsql-novice
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 by date:

Previous
From: Josep Sanchez
Date:
Subject: Re: Upgrade Ubuntu - PostgresSQL is ok?
Next
From: Steve Crawford
Date:
Subject: Re: Convert boolean field to a 0 or a 1 in a select statement