title: sql query about given date if not existing, give latest date
body: <p>I have this table.</p>
  
  <p>InformationValues(attr , dateOfValue, price)</p>
  
  <p>Table Content:</p>
  
  <p><a href="https://i.stack.imgur.com/Kf87n.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Kf87n.png" alt="enter image description here"></a></p>
  
  <p>I need to select all attr with the same date if it  doesn't exist the latest date should be selected.</p>
  
  <p>For example with <code>TO_DATE('01-jan-19')</code></p>
  
  <p>Solution table should look like this:</p>
  
  <p><a href="https://i.stack.imgur.com/kFNVV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kFNVV.png" alt="enter image description here"></a></p>
  
  <p>My sql query so far:</p>
  
  <pre><code>select iv.attr , price, dateofvalue from informationvalues iv where
   dateofvalue = (select max(dateofvalue) from informationvalues where attr = iv.attr) or
   dateofvalue = TO_DATE('01-jan-19');
  </code></pre>
  
  <p>What am I missing ? </p>