Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 8ECCE9FA43C for ; Sat, 30 Dec 2006 14:10:39 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-new, port 10024) with ESMTP id 94525-07 for ; Sat, 30 Dec 2006 14:10:39 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from web54313.mail.yahoo.com (web54313.mail.yahoo.com [206.190.49.123]) by postgresql.org (Postfix) with SMTP id EFDC29FA097 for ; Sat, 30 Dec 2006 14:10:38 -0400 (AST) Received: (qmail 48748 invoked by uid 60001); 30 Dec 2006 18:10:38 -0000 Message-ID: <20061230181038.48746.qmail@web54313.mail.yahoo.com> DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:Date:From:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID; b=KFEk53+YvpR51kjKLs3gJ0B+uC2G3R5MGHjzFkBFHUrYLo390TidxBsX8SkIyb44rBLJwNcE4GBUOWE+hBHurbJEdTBBHfKIdZHlFVApdP75xVDIIsu585kQgh6qeTM9TUlGf228VlEWcZGYAjJbIGPZj9oZQ3+APOITPpVaXdA=; X-YMail-OSG: rkK6XywVM1mG.HCa5Ozk_nMkjan.G4sgGOdf1zjEHauPcHH363NH0iem3KmtEDUzk.8fUasvReyl68vqt__TDIYTqkrZ0NazyYo5wHz7eKk5Gmvj9is3D7dO7B4Ta6V6H.lyJ9Chp4FUPQ-- Received: from [24.10.123.39] by web54313.mail.yahoo.com via HTTP; Sat, 30 Dec 2006 10:10:38 PST Date: Sat, 30 Dec 2006 10:10:38 -0800 (PST) From: chester c young Subject: Re: or function To: "A. R. Van Hook" Cc: pgsql-sql@postgresql.org In-Reply-To: <4596A525.9050008@lake-lotawana.mo.us> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200612/195 X-Sequence-Number: 27151 --- "A. R. Van Hook" wrote: > I have been trying to do an 'or' function such that if a field value > is > zero then use 1 as a multiplier: > "select sum((1 | i.count) * s.cost) as COST ... try "select sum( (case when i.count=0 then 1 else i.count end) * s.cost ) as COST ... __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com