 <p>Yes, you can do it in single query. Combine those condition in one query then sort YMonth <em>DESC</em> and limit by <em>ROWNUM</em></p> <pre><code>SELECT COUNT(*) FROM ( SELECT XXX,YMONTH FROM MyTable WHERE XXX AND YMONTH IN( TO_CHAR(add_months(SYSDATE,0),'YYYYMM'), TO_CHAR(add_months(SYSDATE,-1),'YYYYMM'), TO_CHAR(add_months(SYSDATE,-2),'YYYYMM'), TO_CHAR(add_months(SYSDATE,-3),'YYYYMM'), TO_CHAR(add_months(SYSDATE,-4),'YYYYMM') ) ORDER BY YMONTH DESC ) WHERE ROWNUM &lt;= 3 </code></pre> <p>Please try the query above, and let see if it works.</p>