日期:2014-05-17 浏览次数:20432 次
SELECT co_cl_oid,
ISNULL(SUM(co_amount), 0) AS 年度应收租金
FROM O_ChargeLog
WHERE (co_ci_name = '月租金') AND (YEAR(co_date) = '2013')
GROUP BY co_cl_oid
SELECT co_cl_oid,
ISNULL(SUM(co_amount_actual), 0) AS 年度实收租金
FROM O_ChargeLog
WHERE (co_ci_name = '月租金') AND (YEAR(co_date) = '2013') AND (YEAR(co_charge_date)<='2013')
GROUP BY co_cl_oid
SELECT co_cl_oid,
ISNULL(SUM(co_amount_actual), 0) AS 租金补交
FROM O_ChargeLog
WHERE (co_ci_name = '月租金') AND (YEAR(co_date) = '2013') AND (YEAR(co_charge_date)>'2013')
GROUP BY co_cl_oid
SELECT co_cl_oid ,
SUM(年度应收租金) 年度应收租金 ,
SUM(年度实收租金) 年度实收租金 ,
SUM(租金补交) 租金补交
FROM ( SELECT co_cl_oid ,
ISNULL(SUM(co_amount), 0) AS 年度应收租金 ,
0 年度实收租金 ,
0 租金补交
FROM O_ChargeLog
WHERE ( co_ci_name = '月租金' )
AND ( YEAR(co_date) = '2013' )
GROUP BY co_cl_oid
UNION ALL
SELECT co_cl_oid ,
0 ,