- SQL, , . ( / SQL, Crystal Charting). , , SQL , :
select
ISNULL(tbl1.MNTH, tbl2.MNTH) as RptMonth,
ISNULL(tbl1.CNT,0) as ReceivedCount,
ISNULL(tbl2.CNT,0) as CompletedCount
from
(select dateadd(month, datediff(month, 0, R.RCV_DT),0) as MNTH, COUNT(*) as CNT
from T_YOUR_SOURCE_TABLE R
GROUP BY dateadd(month, datediff(month, 0, R.RCV_DT),0)
) tbl1
FULL OUTER JOIN
(select dateadd(month, datediff(month, 0, R.INV_DT),0) as MNTH, COUNT(*) as CNT
from T_YOUR_SOURCE_TABLE R
GROUP BY dateadd(month, datediff(month, 0, R.INV_DT),0) ) tbl2
on tbl1.MNTH = tbl2.MNTH
where ISNULL(tbl1.MNTH, tbl2.MNTH) between '{CrystalStartDateParam}' and '{CrystalEndDateParam}'
order by tbl1.MNTH
, :
RptMonth ReceivedCount CompletedCount
2005-01-01 00:00:00.000 1465 1269
2005-02-01 00:00:00.000 1264 1163
2005-03-01 00:00:00.000 1466 1561
2005-04-01 00:00:00.000 1505 1504
2005-05-01 00:00:00.000 1329 1416
2005-06-01 00:00:00.000 1540 1529
2005-07-01 00:00:00.000 1263 1216
2005-08-01 00:00:00.000 1249 1316
2005-09-01 00:00:00.000 1520 1460
2005-10-01 00:00:00.000 1448 1240
2005-11-01 00:00:00.000 1321 1239
2005-12-01 00:00:00.000 1421 1302
Crystal , , .