title: LAG(...) IGNORE NULLS OVER (ORDER BY....)
body: <p>I have an ORACLE SQL that has LAG(...) IGNORE NULLS OVER (ORDER BY ...) in the code but getting an error when trying to use it in SQL for a MariaDB.  Does anyone know what similar function is for MariaDB?</p>
  
  <p>UPDATE:</p>
  
  <p>The real database I pull from doesn't have the correct step numbers for REWORK steps, so need to tie the step_no to the last row that has MAIN for a step value. As in the table example the desired_results column has step_no 102 for all the REWORK rows, which is from the last MAIN row with 10/10/2018 01:00:03 claim_ts.</p>
  
  <p>Example code:</p>
  
  <pre><code>WITH testTable AS (
       SELECT '10/9/2018 17:22:54' AS claim_ts, 'MAIN' AS step, '100' AS step_no, '100' as desired_results UNION ALL
       SELECT '10/9/2018 20:39:32', 'MAIN', '101', '101'   UNION ALL
       SELECT '10/10/2018 01:00:03', 'MAIN', '102', '102' UNION ALL
       SELECT '10/10/2018 01:01:44', 'REWORK', '5', '102' UNION ALL
       SELECT '10/11/2018 05:55:20', 'REWORK', NULL, '102' UNION ALL
       SELECT '10/11/2018 13:12:11', 'REWORK', '5', '102' UNION ALL
       SELECT '10/11/2018 16:45:00', 'REWORK', NULL, '102' UNION ALL
       SELECT '10/12/2018 03:08:25', 'MAIN', '103', '103'
  )
  SELECT
  claim_ts,
  step,
  step_no,
  desired_results
  </code></pre>
  
  <p>FROM testTable</p>
  
  <p>Example of the results.</p>
  
  <p><a href="https://i.stack.imgur.com/cn1Nb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cn1Nb.png" alt="Example table"></a></p>
  
  <p><a href="https://dbfiddle.uk/?rdbms=mariadb_10.2&amp;fiddle=d0b8d03336a1ef5b9568bb8e1c8cccae" rel="nofollow noreferrer">dbfiddle with code</a></p>