summing the sum of 2 colums

  • Oh. Now I see what you meant by "duplicates". Yeah, a better way to have details and subtotals would probably be to have two SELECT statements, one for details and one with the group by and rollup, then UNION them together. Sorry to say I've had a load of stuff dropped on me today, so cannot take the time to expand on that, but that technique has also been discussed in this and other web sites.

  • That's exactly what I had to do - use UNION.

    The first select statement selected the fieldnames - agencyName, check, Cash

    The second select after UNION selected the 'Total' as first column, then sum(secondcolumn) as CheckTotal, sum(TotalColumn) as CashTotal

    Now the result looks more like this:

    Agency CheckTotal CashTotal

    Giver1 12.00 0.00

    Giver2 0.00 35.00

    Giver3 18.00 0.00

    Giver4 0.00 10.00

    Total 30.00 45.00

    This is much more acceptable.

    I am still looking for a way to get GrandTotal where 30+45=70 as grandtotal.

    But as at now, I can present this tomorrow and feel much better than I did this morning.

Viewing 2 posts - 16 through 16 (of 16 total)

You must be logged in to reply to this topic. Login to reply