pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: chester c young <chestercyoung@yahoo.com>
To: A. R. Van Hook <hook@lake-lotawana.mo.us>
Cc: pgsql-sql@postgresql.org
Subject: Re: or function
Date: Sat, 30 Dec 2006 10:10:38 -0800 (PST)
Message-ID: <20061230181038.48746.qmail@web54313.mail.yahoo.com> (raw)
In-Reply-To: <4596A525.9050008@lake-lotawana.mo.us>

--- "A. R. Van Hook" <hook@lake-lotawana.mo.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 



view thread (3+ messages)  latest in thread

Message-ID: <20061230181038.48746.qmail@web54313.mail.yahoo.com>
Permalink:  ../20061230181038.48746.qmail@web54313.mail.yahoo.com/
Also on:    postgresql.org/message-id/20061230181038.48746.qmail@web54313.mail.yahoo.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: chestercyoung@yahoo.com, hook@lake-lotawana.mo.us
  Subject: Re: or function
  In-Reply-To: <20061230181038.48746.qmail@web54313.mail.yahoo.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox