title: How do I do an Oracle SQL update from select?
body: <p>I have created a query for updating a table from another table. The field is updating as expected for a given date. The problem is that for other dates, I am now getting NULL values on the column I updated. How do I set the new value only for the specific date and not affect the other dates?</p>
  
  <p>Table A:</p>
  
  <pre><code>| ID | VALUE |      ADD_TIME        |
  -------------------------------------
  | 1  | -5    |1/11/2019 10:45:11 am |
  </code></pre>
  
  <p>Table B:</p>
  
  <pre><code>|AS_OF_DATE| ID | VALUE |
  -------------------------
  |2/29/2019 | 1  |  -4   |
  |1/31/2019 | 1  |  -4   |
  |12/31/2018| 1  |  -4   |
  </code></pre>
  
  <p>Desired Output:</p>
  
  <pre><code>|AS_OF_DATE| ID | VALUE |
  -------------------------
  |2/29/2019 | 1  |  -4   |
  |1/31/2019 | 1  |  -4   |
  |12/31/2018| 1  |  -5   |
  </code></pre>
  
  <p>Current Output:</p>
  
  <pre><code>|AS_OF_DATE| ID | VALUE |
  -------------------------
  |2/29/2019 | 1  |       |
  |1/31/2019 | 1  |       |
  |12/31/2018| 1  |  -5   |
  </code></pre>
  
  <p>My Query:</p>
  
  <pre><code>update TABLEB
  set VALUE =
  (
    select VALUE from TableA
    where ID = '1'
    and TABLEB.AS_OF_DATE &lt; TABLEA.ADD_TIME
  )
  </code></pre>