Re: or function

From: chester c young <chestercyoung(at)yahoo(dot)com>
To: "A(dot) R(dot) Van Hook" <hook(at)lake-lotawana(dot)mo(dot)us>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: or function
Date: 2006-12-30 18:10:38
Message-ID: 20061230181038.48746.qmail@web54313.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

--- "A. R. Van Hook" <hook(at)lake-lotawana(dot)mo(dot)us> 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

In response to

  • or function at 2006-12-30 17:43:01 from A. R. Van Hook

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2006-12-30 18:11:36 Re: or function
Previous Message A. R. Van Hook 2006-12-30 17:43:01 or function