title: SQL getting records for the last quarter with 30 days grace period
body: <p>I want to find the company records which has not done the filing for the last quarter, but i want to give grace period of 30 days. As in till Oct 30 2018, the company_seq should not be fetched. I am not able to do the grace period part. Can someone please help me?</p>
  
  <p>And more thing to consider is, if the filing is not done for the previous quarter i.e. quarter 2, then the company sequence should be fetched</p>
  
  <p>Sample Data</p>
  
  <pre><code>Company_seq YEAR    QUARTER
  1           2018    2
  1           2018    3
  2            2018   2
  2           2018    1
  3          2018 1
  
  Company_SEQ COMPANY_NAME    
  1           Company 1   
  2          Company2 
  3           Company3    
  
  
  
  SELECT * FROM COMPANY 
  WHERE company_seq NOT IN 
      (SELECT DISTINCT company_seq 
          FROM Filing F
          WHERE YEAR = (SELECT TO_CHAR(add_months(sysdate,-3),'YYYY') from dual)
          AND quarter=(SELECT TO_CHAR(add_months(sysdate,-3),'Q') from dual)
  </code></pre>
  
  <p>Expected Query output:</p>
  
  <pre><code>3, Company3
  </code></pre>