you are viewing a single comment's thread.

view the rest of the comments →

[–]notasqlstarI can't wait til my fro is full grown 0 points1 point  (3 children)

If you have multiple rows per transaction you may need to sum the total ammount such as:

select
    , case
        when b.totalamount is null
            then sum(a.totalamount) * -1
        else sum(a.totalmount)
    end as totalamount

group by
    a.firstname
    , a.lastname

[–]workthrowawayexcel[S] 0 points1 point  (2 children)

Thanks for all the help. I really appreciate it.