你能帮我在下面吗?
我根据要求编写了以下查询
SQL> SELECT mon."months",
2 COUNT (DECODE (e1.ename, 'RAVI', 1, DECODE (e1.ename, 'KIRAN', 1, NULL))
3 ) AS "num-review"
4 FROM (SELECT TO_CHAR (ADD_MONTHS (SYSDATE, LEVEL - 7),
5 'MON-YYYY'
6 ) "months"
7 FROM DUAL
8 CONNECT BY LEVEL <= 18
9 ORDER BY LEVEL) mon, (select ename, hiredate, to_char(hiredate,'MON-YYYY') "Month" from emp_copy) e1
10 WHERE mon."months"=e1."Month"(+)
11 GROUP BY "months";
months num-review
-------- ----------
APR-2013 0
AUG-2013 0
DEC-2012 1
DEC-2013 0
FEB-2013 2
FEB-2014 0
JAN-2013 1
JAN-2014 0
JUL-2013 0
JUN-2013 0
MAR-2013 0
months num-review
-------- ----------
MAY-2013 0
NOV-2012 0
NOV-2013 0
OCT-2012 1
OCT-2013 0
SEP-2012 1
SEP-2013 0
18 rows selected.
在这里我必须得到像
Sep-2012
Oct-2012
Nov-2012
Dec-2012
Jan-2013
Feb-2013
Mar-2013
Apr-2013
May-2013
Jun-2013
Jul-2013
Aug-2013
Sep-2013
Oct-2013
Nov-2013
Dec-2013
Jan-2014
Feb-2014
但我以不同的方式获得输出。谁能帮我解决这个问题。