I have 3 select statements I am using a UNION to bring them all together, is there a way to get a sum on the entire select statement?
Results are still giving me more than one amount per id.acc(account #)
SELECT a.id_Acc, sum(a.amount) as "Payments"
from t_pv_payment b, t_acc_usage a
where a.id_sess = b.id_sess
and (a.id_usage_interval = '45467')
group by a.id_acc
UNION
SELECT a.id_Acc, sum(a.amount) as "Payments"
from t_pv_accountcredit b, t_acc_usage a
where a.id_sess = b.id_sess
and (a.id_usage_interval = '45467')
group by a.id_acc
UNION
SELECT a.id_Acc, sum(a.amount) as "Payments"
from t_pv_aradjustment b, t_acc_usage a
where a.id_sess = b.id_sess
and (a.id_usage_interval = '45467)
group by a.id_acc
order by a.id_acc
Results are still giving me more than one amount per id.acc(account #)
SELECT a.id_Acc, sum(a.amount) as "Payments"
from t_pv_payment b, t_acc_usage a
where a.id_sess = b.id_sess
and (a.id_usage_interval = '45467')
group by a.id_acc
UNION
SELECT a.id_Acc, sum(a.amount) as "Payments"
from t_pv_accountcredit b, t_acc_usage a
where a.id_sess = b.id_sess
and (a.id_usage_interval = '45467')
group by a.id_acc
UNION
SELECT a.id_Acc, sum(a.amount) as "Payments"
from t_pv_aradjustment b, t_acc_usage a
where a.id_sess = b.id_sess
and (a.id_usage_interval = '45467)
group by a.id_acc
order by a.id_acc