【发布时间】:2017-04-15 01:10:47
【问题描述】:
select (select SUM(t.fees_amount)from unit u, payment p, type_of_fees t WHERE u.unit_id = p.unit_id AND p.stof = t.stof AND u.unit_id LIKE '%U1001%'
AND p.stat = 'not payed') "BLOCK 1(Not Payed)",
(select SUM(t.fees_amount)from unit u, payment p, type_of_fees t WHERE u.unit_id = p.unit_id AND p.stof = t.stof AND u.unit_id LIKE '%U1001%'
AND p.stat = 'payed') "BLOCK 1(Payed)",
(select SUM(t.fees_amount)from unit u, payment p, type_of_fees t WHERE u.unit_id = p.unit_id AND p.stof = t.stof AND u.unit_id LIKE '%U1002%'
AND p.stat = 'not payed') "BLOCK 2(Not Payed)",
(select SUM(t.fees_amount)from unit u, payment p, type_of_fees t WHERE u.unit_id = p.unit_id AND p.stof = t.stof AND u.unit_id LIKE '%U1002%'
AND p.stat = 'payed') "BLOCK 2(Payed)"
from dual;
还有其他方法可以解决吗?
【问题讨论】: