title: SQL Query > sysdate <Sysdate + 1 year
body: <p>I am trying to write a query that will find the max expiration date but what i noticed is when I am doing this I get no results if I have a  expiration date  lets say 30-Dec-16 and for the same part I also have an expiration date of 01-Jan-2099 (which is the default date if nothing is filled in) below is my query how could I rewrite the expiration_date query to get the correct date.</p>
  
  <pre><code>SELECT 
   Part,
   price,
   effective_date,
   expiration_date
  FROM a.Table 
   WHERE Part IN ('&amp;Part') 
   AND PRICE  IN ('somewere') 
   AND expiration_date IN (SELECT 
                            MAX(expiration_date) 
                            FROM table  
                            WHERE expiration_date &gt; SYSDATE 
                            AND  part IN ('&amp;Part)  
                            AND PRICE IN (Somewere)) 
   AND to_date(effective_date) IN (SELECT 
                                    MAX(EFFECTIVE_DATE) FROM b.table  
                                    WHERE expiration_date &gt; SYSDATE 
                                    AND  Part IN ('&amp;Part)  
                                    AND price  IN (somewere) 
                                    AND EFFECTIVE_DATE &lt; SYSDATE + 1)
  </code></pre>