From: | "Ian Harding" <ianh(at)tpchd(dot)org> |
---|---|
To: | <philip(at)adhesivemedia(dot)com>, <roberto(at)smartbit(dot)inf(dot)br> |
Cc: | <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Boolean to Integer? |
Date: | 2002-10-17 17:23:40 |
Message-ID: | sdae8fd6.043@mail.tpchd.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
select case when boolfield = true then 1 else 0 end as boolint
from booltable
>>> Philip Hallstrom <philip(at)adhesivemedia(dot)com> 10/17/02 10:09AM >>>
Search the manual for "CASE" I can never remember the syntax, but that's
what you want... it's behaves similar to a C switch statement.
On Thu, 17 Oct 2002, Roberto (SmartBit) wrote:
> Hi all
>
> How could i transform a Boolean value in a Integer???
>
> My table field is Boolean, but I'd like that my SELECT reults an Integer
> field!!
>
> something like: SELECT IF( FieldBoolName , 1, 0) FROM myTABLE
>
>
> tia
>
>
> Roberto de Amorim - +55 48 346-2243
> Software engineer at SmartBit Software
> Delphi and Interbase consultant
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
>
---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2002-10-17 17:30:40 | Re: Help normalizing table(s) |
Previous Message | Philip Hallstrom | 2002-10-17 17:09:17 | Re: Boolean to Integer? |