Booleans and Casting

Поиск
Список
Период
Сортировка
От Paul Ramsey
Тема Booleans and Casting
Дата
Msg-id 36C4A85E.980EF852@refractions.net
обсуждение исходный текст
Список pgsql-general
I have the following SQL statement, which doesn't work (though I wish it
did):

  select sum(value * ( plulabel = 'FO' )) from btmm group by gis_tag;

PG quite correctly complains that:

  ERROR:  There is more than one possible operator '*' for types
'float4' and 'bool' You will have to retype this query using an explicit
cast

However, when I do this:

  select sum(value * int( plulabel = 'FO' )) from btmm group by gis_tag;

I still get an error:

  ERROR:  No such function 'int' with the specified attributes

I can find no function at all to use to cast booleans to what I want,
which is 1 = true, 0 = false (IE, the standard cast for boolean ->
number).

Any advice?


--
      __
     /
     | Paul Ramsey
     | Refractions Research
     | Email: pramsey@refractions.net
     | Phone: (250) 885-0632
     \_

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

Предыдущее
От: Simon Drabble
Дата:
Сообщение: Book recommendation
Следующее
От: Stephan Doliov
Дата:
Сообщение: Re: Subject: Re: [GENERAL] A book for PgSQL? A need? yes? no?