I have this query
that returns this
So I tried it with rollup
I have tried with Rollup and Cube and cannot seem to get the same result
What am I missing?
Thanks,
Willie
Code:
select rd.insert_date, cost_per_space, deposit_per_space, rd.num_spaces, isnull(processing_fee,0) as processing_fee, Total_Cost, amt_paid, (total_cost+isnull(processing_fee,0)-amt_paid) AS balance_due
from ycmhome.contactinfo ci join ycmhome.registration r on ci.contact_id = r.contact_id
join ycmhome.reg_details rd on r.registration_id = rd.registration_id
join ycmhome.events e on rd.event_id = e.event_id
where ci.church_id = 242 and rd.event_id = 461 and r.isactive = 1 and e.isactive = 1
order by rd.event_id
compute sum(rd.num_spaces), sum(isnull(processing_fee,0)), sum(total_cost), sum(amt_paid), sum(total_cost+isnull(processing_fee,0)-amt_paid) by rd.event_id
that returns this
Code:
2014-10-30 20:13:59.393 399 100 2 4.00 798 0 802.00
2 4.00 798 0 802.00
So I tried it with rollup
Code:
select rd.insert_date, cost_per_space, deposit_per_space, rd.num_spaces, isnull(processing_fee,0) as processing_fee, Total_Cost, amt_paid, (total_cost+isnull(processing_fee,0)-amt_paid) AS balance_due
from ycmhome.contactinfo ci join ycmhome.registration r on ci.contact_id = r.contact_id
join ycmhome.reg_details rd on r.registration_id = rd.registration_id
join ycmhome.events e on rd.event_id = e.event_id
where ci.church_id = 242 and rd.event_id = 461 and r.isactive = 1 and e.isactive = 1
group by rd.insert_date, cost_per_space, deposit_per_space, rd.num_spaces, isnull(processing_fee,0) as processing_fee, Total_Cost, amt_paid, (total_cost+isnull(processing_fee,0)-amt_paid) with rollup
I have tried with Rollup and Cube and cannot seem to get the same result
Code:
2014-10-30 20:13:59.393 399 100 2 4.00 798 0 802.00
2014-10-30 20:13:59.393 399 100 2 4.00 798 0 802.00
2014-10-30 20:13:59.393 399 100 2 4.00 798 NULL NULL
2014-10-30 20:13:59.393 399 100 2 4.00 NULL NULL NULL
2014-10-30 20:13:59.393 399 100 2 NULL NULL NULL NULL
2014-10-30 20:13:59.393 399 100 NULL NULL NULL NULL NULL
2014-10-30 20:13:59.393 399 NULL NULL NULL NULL NULL NULL
2014-10-30 20:13:59.393 NULL NULL NULL NULL NULL NULL NULL
NULL NULL NULL NULL NULL NULL NULL NULL
What am I missing?
Thanks,
Willie