conditional sum

2008-09-05 Thread kalin m
hi... how do i do conditional sums? like: select a.job, sum(if b.amount 0 then amount end if ) from t1 as a left join t2 as b on a.account=b.accoun where a.account = b.account group by a.job; or select a.job, if b.amount 0 then sum(b.amount) end if from t1 as a left join t2 as b on

Re: conditional sum

2008-09-05 Thread kalin m
i got closer but i can't figure out this: individually: A) select a.job, sum(b.money) from t1 as a left join t2 as b on a.account = b.account where a.job = ca1 and b.money 0; +--+---+ | job | sum(b.money) |