title: SQL - Window function to get values from previous row where value is not null
body: <p>I am using Exasol, in other DBMS it was possible to use analytical functions such <code>LAST_VALUE()</code> and specify some condition for the <code>ORDER BY</code> clause withing the <code>OVER()</code> function, like:</p>
  
  <pre><code>select ...
  LAST_VALUE(customer) 
  OVER (PARTITION BY ID ORDER BY date_x DESC ROWS BETWEEN UNBOUNDED PRECEDING AND 1 PRECEDING ) as the_last
  </code></pre>
  
  <p>Unfortunately I get the following error:</p>
  
  <blockquote>
    <p>ERROR:    [0A000] Feature not supported: windowing clause (Session:
    1606983630649130920)</p>
  </blockquote>
  
  <p>the same do not happen if instead of <code>AND 1 PRECEDING</code> I use: <code>CURRENT ROW</code>.</p>
  
  <p>Basically what I wanted is to get the <strong>last value</strong> according the Order by that is NOT the current row. In this example it would be the $customer of the previous row. </p>
  
  <p>I know that I could use the <code>LAG(customer,1) OVER ( ...)</code> but the problem is that I want the previous customer that is NOT null, so the offset is not always 1...</p>
  
  <p>How can I do that?</p>
  
  <p>Many thanks!</p>