Boolean to integer conversion

Поиск
Список
Период
Сортировка
От JORGE MALDONADO
Тема Boolean to integer conversion
Дата
Msg-id CAAY=A78ijwreBTqwxOWwd8pW-8SzoCaUm4Ah1eRXOewp6MiZwA@mail.gmail.com
обсуждение исходный текст
Ответы Re: Boolean to integer conversion  (Thomas Kellerer <spam_eater@gmx.net>)
Список pgsql-novice
Is it possible to convert a boolean field to integer? (True = 1, False = 0)

In the following example, "price" is a non-zero numeric field and "status" is a boolean field. So that, when "status=False" then "final_price=0.00" and when "status=True" then "final_price <> 0.00". 

SELECT (price * status) AS final_price

I know that I can use a "CASE WHEN..." statement but, in this case, it is not the solution I am looking for.

Regards,
Jorge Maldonado

В списке pgsql-novice по дате отправления:

Предыдущее
От: Merlin Moncure
Дата:
Сообщение: Re: Show stored function code
Следующее
От: Thomas Kellerer
Дата:
Сообщение: Re: Boolean to integer conversion