Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Re: or function



--- "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 



Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group