title: Query to add quarter condition in SQL
body: <p>I have a scenario in which if the system date is between 1 to 5 of the current quarter the calculation should not include current quarter data and if it is greater than 5 it has to include all the data. </p>
  
  <p>I am trying to include this condition in where clause but I am not able to acheive the result. </p>
  
  <p>Could you please help me in this condition</p>
  
  <pre><code>SELECT 
       Dense_Rank() over(order by AMOUNT desc)as RANK,
       FISCAL,       
       AMOUNT
    FROM 
       T1 INNER JOIN  T2     ON 1=1
    WHERE ( FISCAL&lt;( CASE WHEN t2.SYSDATE BETWEEN t2.CURRENTQUARTER_START_DATE  AND    ADD_DAYS(tw.CURRENTQUARTER_START_DATE,4)
                           THEN CURRENT_QUARTER                           
                           END ) OR (NULL)
  </code></pre>
  
  <p>I am not sure how to include that condition.</p>