Received: from 00-20-78-13-42-6f.bconnected.net (IDENT:root@00-20-78-13-42-6f.bconnected.net [209.53.3.99]) by hub.org (8.9.2/8.9.1) with ESMTP id QAA29281 for ; Fri, 12 Feb 1999 16:33:55 -0500 (EST) (envelope-from pramsey@refractions.net) Received: from refractions.net (24.65.20.167.bc.wave.home.com [24.65.20.167]) by 00-20-78-13-42-6f.bconnected.net (8.8.7/8.8.7) with ESMTP id NAA29468 for ; Fri, 12 Feb 1999 13:34:04 -0800 Sender: pramsey@00-20-78-13-42-6f.bconnected.net Message-ID: <36C49E14.84C93DA5@refractions.net> Date: Fri, 12 Feb 1999 13:33:08 -0800 From: Paul Ramsey Organization: Refractions Research X-Mailer: Mozilla 4.5 [en] (X11; I; Linux 2.2.1-ac5 i686) X-Accept-Language: en MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Booleans and Casting Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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 \_