title: Lead and Lag function in Mysql
body: <p>I have two columns <code>case_id</code> and <code>assigned_date</code> in my <strong><em>temporary</em></strong> table in mysql. As there is no direct function to get lead and lag likewise oracle in mysql. Want to get lead and lag both values for assigned date against each case id generated . How to achieve that. Attached is my sample data.</p>
  
  <pre><code>case_id                                  assigned_date
  41c19f76-e52e-c4c9-62c2-573c71ec5d50    2016-05-18 14:08:14.0
  41c19f76-e52e-c4c9-62c2-573c71ec5d51    2016-05-18 14:25:22.0
  41c19f76-e52e-c4c9-62c2-573c71ec5d50    2016-05-18 14:26:01.0
  41c19f76-e52e-c4c9-62c2-573c71ec5d50    2016-05-19 07:19:13.0
  41c19f76-e52e-c4c9-62c2-573c71ec5d50    2016-05-19 07:53:09.0
  41c19f76-e52e-c4c9-62c2-573c71ec5d51    2016-05-19 08:18:01.0
  41c19f76-e52e-c4c9-62c2-573c71ec5d50    2016-05-19 12:12:35.0
  </code></pre>