我正在加入四个视图以在 ReportingMonth 上显示 A/R、销售额、存款等。但我在几个月里得到了重复。向下看,特别是 2014 年 1 月、2014 年 2 月、2012 年 12 月。
是)我有的:
SELECT ISNULL(ISNULL(ISNULL(outf.ReportingMonth, sales.ReportingMonth), dep.ReportingMonth), ar.ReportingMonth) AS ReportingMonth
,ar.AR_100_Percent AS EndOfMonthARBalance
,ar.AR_85_Percent AS MLOCCeiling
,sales.MonthlySales AS Sales
,dep.Deposits
,outf.Outflow
,dep.Deposits + outf.Outflow AS CashPerformance
FROM vCI_MLOC_MONTHLYAR ar
FULL OUTER JOIN vCI_MLOC_MONTHLYSALES sales
ON ar.ReportingMonth = sales.ReportingMonth
FULL OUTER JOIN vCI_MLOC_MONTHLYDEPOSITS dep
ON sales.ReportingMonth = dep.ReportingMonth
FULL OUTER JOIN vCI_MLOC_MONTHLYOUTF outf
ON dep.ReportingMonth = outf.ReportingMonth
GROUP BY outf.ReportingMonth
,dep.ReportingMonth
,ar.ReportingMonth
,sales.ReportingMonth
,ar.AR_100_Percent
,ar.AR_85_Percent
,sales.MonthlySales
,dep.Deposits
,outf.Outflow