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

From: Sameer Kumar <sameer(dot)kumar(at)ashnik(dot)com>
To: JORGE MALDONADO <jorgemal1960(at)gmail(dot)com>
Cc: "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Convert boolean field to a 0 or a 1 in a select statement
Date: 2015-01-12 06:31:27
Message-ID: CADp-Sm7UjpUSV9JHjhwwOy1dp0ETsWqstKaPvikc6Mriuy3UwA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Sat, Jan 10, 2015 at 12:47 AM, JORGE MALDONADO <jorgemal1960(at)gmail(dot)com>
wrote:

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

​Why do you want to cast it first to char?

And anyways what is the issue with casting it to number first and then
casting it to char?

Best Regards,

*Sameer Kumar | Database Consultant*

*ASHNIK PTE. LTD.*

101 Cecil Street, #11-11 Tong Eng Building, Singapore 069533

M: *+65 8110 0350* T: +65 6438 3504 | www.ashnik.com

*[image: icons]*

[image: Email patch] <http://www.ashnik.com/>

This email may contain confidential, privileged or copyright material and
is solely for the use of the intended recipient(s).

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Zelaznik, Steve 2015-01-13 14:18:41 Re: Convert boolean field to a 0 or a 1 in a select statement
Previous Message Ravi Kiran 2015-01-11 14:53:02 Hash function