Re: [SQL] or function

2006-12-30 Thread Tom Lane
"A. R. Van Hook" <[EMAIL PROTECTED]> writes: > 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 Bitwise OR will surely not do what you want. I think the most effective solution is probably CA

Re: [SQL] or function

2006-12-30 Thread chester c young
--- "A. R. Van Hook" <[EMAIL PROTECTED]> 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 ...

[SQL] or function

2006-12-30 Thread A. R. Van Hook
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 seems to work ok when the value is 0 but I get the wrong value is i.count in not zero stid | count | tot | ldate| pkcnt | status | cost ---